尝试打印出文件的 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.
要使其在批处理文件中运行还需要什么?
最佳答案
你需要转义 % 是批处理文件
只需输入 cmd/e:on/c for %%A in (8088_othello.com) do @echo %%~nxsA
关于windows - 命令在命令提示符中有效,但在批处理文件中无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18192880/