windows和linux路径斜杆转换脚本,打开即用

前言:

windows和linux的目录路径斜杆是相反的,在ssh或者其他什么工具在win和ubuntu传文件时候经常需要用到两边的路径,有这个工具就不用手动去修改斜杆反斜杠了。之前有个在线网站,后来挂了,就想着自己搞一个脚本来用。先看效果,代码放后面了,或者直接下载脚本也行。

效果:

输入路径之后回车,它会自动识别是/或者\,并且转换成另外一种格式的路径。

编写方式:

新建一个.bat结尾的脚本,名字任意;

编辑,写入代码:

复制代码
@echo off
chcp 65001 > nul
setlocal enabledelayedexpansion

:input
set /p "input_path=请输入路径: "
if "%input_path%"=="" goto :eof

set "output_path="
set "temp_path=%input_path%"
:process_path
if not defined temp_path (
    echo 转换后的路径为: 
    echo.
    echo !output_path!
    echo.
    goto :input
)

set "char=!temp_path:~0,1!"
if "%char%"=="\" (
    set "output_path=!output_path!/!"
) else if "%char%"=="/" (
    set "output_path=!output_path!\!"
) else (
    set "output_path=!output_path!!char!"
)

set "temp_path=!temp_path:~1!"
goto :process_path

脚本下载:

资源那

相关推荐
赖small强23 分钟前
【蓝牙】BLE 数据收发实战指南(手机 App ↔ 嵌入式 Linux/BlueZ)
linux·蓝牙·bluez·bluetoothctl·dbus-monitor·central·peripheral
wit_yuan25 分钟前
linux udp广播数据包实际用例
linux·服务器·udp
大聪明-PLUS25 分钟前
io_uring:Linux 上的高性能异步 I/O
linux·嵌入式·arm·smarc
qq_4798754334 分钟前
Linux time function in C/C++【2】
linux·c语言·c++
小武~1 小时前
嵌入式网络编程深度优化 --网络协议栈配置实战指南
linux·网络·网络协议
二进制星轨1 小时前
在 Ubuntu 上快速配置 Node.js 环境(附问题说明)
linux·ubuntu·node.js
kblj55551 小时前
学习Linux——网络——网卡
linux·网络·学习
Physicist in Geophy.1 小时前
新版ubuntu中sac安装问题(缺少libncurses5)
linux·运维·ubuntu
菲兹园长2 小时前
微服务组件(E、L、N、O、G)
linux·服务器·gateway
xier_ran2 小时前
Python从入门到精通:(2)Python 核心进阶教程从数据结构到面向对象
linux·windows·python·microsoft