Reputation: 16652
Trying to print out the 8dot3 name of a file, it does works when I paste the line in the Command Prompt but not when I run it from a batch file.
Result when pasted :
D:\tmp>cmd /e:on /c for %A in (8088_othello.com) do @echo %~nxsA
8088_O~1.COM
Result from batch file :
D:\tmp>lfn.bat
D:\tmp>cmd /e:on /c for ~nxsA
~nxsA was unexpected at this time.
What else is needed to make it work inside a batch file ?
Upvotes: 4
Views: 6728
Reputation: 1244
you need to escape % is batch files
just type cmd /e:on /c for %%A in (8088_othello.com) do @echo %%~nxsA
Upvotes: 8