A Simple (Minded?) Windows sudo Substitute for Cygwin in Perl
With a little Win32::FileOp magic, it is easy to whip up a simple (minded?) Windows sudo(1) substitute for Cygwin:
#!/usr/bin/env perl# ------ pragmas
use strict;
use warnings;
use Win32::FileOp;Win32::FileOp::ShellExecute( runas => "cmd.exe", "/k " . join(' ', @ARGV) );
Apart from how you start it, a similar approach should work for Strawberry Perl once Win32::FileOp is installed.
The underlying idea is that usually (at least for *me*) I don't care whether I am actually executing as the Administrator account -- I just temporarily need the Administrator's account's permissions (like for netstat -ab under Windows).
Note that this creates a separate console window that stays open after your command has completed. (A *real* sudo(1) substitute would work in the current console window, but that would take more time than I have available now during this session of yak-shaving.)
"A simple 'su' substitute" might be more accurate.
Hmmm... Since the program is executing another command rather than always bringing up a shell, I called it a 'sudo' substitute. (Though you can certainly use it to bring up a shell.)