如果不存在含&号的文件名,这样最快:- @echo off
- for %%a in (%*) do echo %%a
- pause
复制代码 如果要同时操作多个文件,可能要用shift:- @echo off
- :again
- echo "%~1"
- shift
- if "%~1" neq "" goto again
- pause
复制代码 如果要兼容特殊字符,可以这样:- @echo off
- set "tmp=%*"
- setlocal enabledelayedexpansion
- set cmd=?!cmdcmdline:*.bat^=!
- set cmd=!cmd:?" =?!
- for %%a in (!cmd:~1!) do echo %%a
- pause
复制代码
|