I am running strawberry perl 5.30 under windows 11.
I am trying to use fsutil to create an 8dot3 name for a directory name which includes unicode characters. The command is:
fsutil file setShortName "C:/Users/James/Music/國語懷 +;念老歌 Vol. 2" "Vol2~00A"
FYI, the characters are Chinese - not displayed correctly here for some reason. Anyway, when I enter the command directly into a command shell, it creates the 8dot3 name as desired. But if I try to run the command in a perl program using backticks, it does not work.
Here is my program:
use strict; use warnings; use utf8; use open ':std', ':encoding(UTF-8)'; use Win32::Unicode; use Win32::Unicode::Dir; use Win32::Unicode::File; use Win32::Unicode::Console; use Win32::Console; Win32::Console::OutputCP(65001); # code page for Unicode (UTF-8) my $cmd = "fsutil file setShortName \"C:/Users/James/Music/國 +5486;懷念老歌 Vol. 2\" \"Vol2~00A\""; my $trans = `$cmd`; print "CMD: $cmd\nTRANS: \"$trans\"";
The output is:
CMD: fsutil file setShortName "C:/Users/James/Music/國語&# +25079;念老歌 Vol. 2" "Vol2~00A" TRANS: "Error: The system cannot find the file specified.
Can anyone help me understand why I an getting this result, and what I can change to fix it?
Thanks
In reply to Problem running shell command from Perl by CrashBlossom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |