I want my batch file to only run elevated. If not elevated, provide an option for the user to relaunch batch as elevated.
I\'m writing a batch file to set a system v
You can have the script call itself with psexec's -h
option to run elevated.
I'm not sure how you would detect if it's already running as elevated or not... maybe re-try with elevated perms only if there's an Access Denied error?
Or, you could simply have the commands for the xcopy
and reg.exe
always be run with psexec -h
, but it would be annoying for the end-user if they need to input their password each time (or insecure if you included the password in the script)...