我看论坛没有,所以分享
比较好奇的是运用场景在哪里啊.....
把俩个文件名称交换【拖动到bat处理】- @echo off
- if "%~2"=="" (
- echo Drag two files into this bat to swapping files names
- pause
- exit /b
- )
- if not "%~3"=="" (
- echo Can only swap two files names
- pause
- exit /b
- )
- set "file1=%~n1"
- set "file2=%~n2"
- set "ext1=%~x1"
- set "ext2=%~x2"
- set "temp=%random%"
- ren "%~1" "%temp%%ext1%"
- ren "%~2" "%file1%%ext2%"
- ren "%temp%%ext1%" "%file2%%ext1%"
复制代码
|