in reply to How to determine if a user has administrator privileges in Windows environment
Don't get fancy. Also, /bin/id isn't the best solution. Again, it's better to verify if you have the privileges you need vs. seeing if you're root. Your solution won't work in a sudo environment.sub is_windows_admin { eval { open my $fh, "> C:/windows/system32/perl_check_if_windows_a +dmin" or die; 1; } && 1; } if ( is_windows_admin() ) { # Strut your stuff }
|
|---|