WinDOS uses the DOS model and does not pass arguments to invoked processes, only a "command tail" string that all Windows C runtime libraries parse into argc and argv using some rules or other.
Using wperl as in your example means that $pathToMyself is already being passed as the "command tail" to wperl. Try:
my $argtail = join ' ', @args; exec(qw/wmic process call create/ => "CommandLine='wperl $pathToMyself + $argtail'");
If you are wondering, yes, this does mean that arguments containing whitespace are a problem. Quoting is handled by C runtime library startup code and that can vary from program to program because there is no standard system C runtime library on Windows.
In reply to Re^4: Restarting a Perl script on Windows 10
by jcb
in thread Restarting a Perl script on Windows 10
by petro4213
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |