Convert long filename to short filename (8.3) using cmd.exe
Replace the filename.txt to the filename you want to convert to 8.3
dir /x filename.txt
You will then have to split the result with whitespace as your delimiter (\s in regex). Then the value with the ~ is your short filename. If your filename is short to begin with, then you won't find a string containing a ~.
cmd /c for %A in ("C:\Documents and Settings\User\NTUSER.DAT") do @echo %~sA