Subject: | small issue in RunAsAdmin v0.02 if directory of the script contains a space |
Date: | Sun, 19 Oct 2014 18:04:24 +0200 |
To: | <bug-Win32-RunAsAdmin [...] rt.cpan.org> |
From: | Mister Too <Mister_Too [...] hotmail.com> |
Hello Michael,
First of all: Thanks for the solution to my problem migrating my Perl
scripts from Win server 2003 to Win server 2008 at work and discovering UAC
was messing things up !
I found a small issue in RunAsAdmin v0.02: if the script is in a
subdirectory which contains a special character like a space, the restart
will fail with the following error:
Can't open perl script "C:\Users\MyName\Prg\Perl": No such
file or directory
In this case my script is in C:\Users\MyName\Prg\Perl RunAsAdmin\
directory (notice the space between Perl and RunAsAdmin)
It was a bit tedious to find what went wrong exactly because the restart in
another command window was gone before I could see the actual error message
(finally I needed to do a screenprint on the right moment before I saw what
the problem was ;-) )
To fix this problem on my Win 8.1 home PC I changed your restart subroutine
as follows
From:
run (shift(@actual_args), shift(@actual_args) . ' ' .
escape_args(@actual_args));
to:
run ('"' . shift(@actual_args) . '"', '"' . shift(@actual_args) . '" ' .
escape_args(@actual_args));
Tomorrow I will install RunAsAdmin at work on Win2008 and see if it works
there also (I'm confident that it will !)
Regards, Mister_too