4

尝试打印出文件的 8dot3 名称,当我将该行粘贴到命令提示符中时它确实有效,但当我从批处理文件运行它时无效。

粘贴时的结果:

D:\tmp>cmd /e:on /c for %A in (8088_othello.com) do @echo %~nxsA

8088_O~1.COM

批处理文件的结果:

D:\tmp>lfn.bat

D:\tmp>cmd /e:on /c for ~nxsA

~nxsA was unexpected at this time.

还需要什么才能使其在批处理文件中工作?

4

1 回答 1

8

你需要转义 % 是批处理文件

只需键入 cmd /e:on /c for %%A in (8088_othello.com) do @echo %%~nxsA

于 2013-08-12T17:39:24.173 回答