Edit: I reported this as a bug to Raku: qqx, shell not operating quotes properly https://github.com/rakudo/rakudo/issues/3518
and one of the administrators referred me to How should Proc::Async.new, run and shell call cmd.exe? https://github.com/Raku/problem-solving/issues/20
which does sound exactly like what is occurring, especially the "It's not possible to escape spaces using ^." part.
If anyone comes up with a workaround, I would appreciate it.
Windows 7, and Windows 10-1909
Rakudo Star version 2019.03.1
How do I code this command in Raku?
fsutil usn readdata "C:/NtUtil/test 1"
The big bug-a-boo is that the file name has a space in it and Windows required double quotes around it. Single quotes crash.
I can not get either of these two to work with a file name with a space in it. fsutil either sees two parameters or one parameter where the name actually contains double quotes:
my @Result = qqx { C:/Windows/System32/fsutil.exe usn readdata "$FileName" }.lines;
for @Result -> $Line { say $Line; };
my $proc=run( "dir", "$FileName", :out );
my @RtnStr = $proc.out.slurp-rest.lines;
for @RtnStr -> $Line { say $Line; }
Many thanks, -T
Edit: added Windows 10-1909 to the fray
Edit: no symptom change with "shell" command:
@Result = shell( "C:/Windows/System32/fsutil.exe usn readdata \"$FileName\"" ).lines;
for @Result -> $Line { say $Line; };
Usage : fsutil usn readData <filename>
Eg : fsutil usn readData C:\Temp\sample.txt
@Result = shell( "C:/Windows/System32/fsutil.exe usn readdata \"$FileName\"" );
for @Result -> $Line { say $Line; };
Exit with:
Proc.new(in => IO::Pipe, out => IO::Pipe, err => IO::Pipe, exitcode => 1, signal => 0, pid => 1728, command => ("C:/Windows/System32/fsutil.exe usn readdata \"C:/NtUtil/test 1\"",))
Note the "exitcode => 1" and the last parameter with the back slashes in it
Edit: using the single quote method:
@Result = shell( 'C:/Windows/System32/fsutil.exe usn readdata "$FileName"' );
results in the same error:
Usage : fsutil usn readData <filename>
Eg : fsutil usn readData C:\Temp\sample.txt
Error: The filename, directory name, or volume label syntax is incorrect.
Proc.new(in => IO::Pipe, out => IO::Pipe, err => IO::Pipe, exitcode => 1, signal => 0, pid => 1192, command => ("C:/Windows/System32/fsutil.exe usn readdata \"\$FileName\"",))