The question "How to request Administrator access inside a batch file" has already been answered and I use this script. However, on a system with two user accounts: a normal user account and an admin user account I want to run my script from the normal user account, have it ask for admin privilege, then run the main part of my script (so far so good).
In the main part of my script I want to use the path to the home folder of the normal user account. I tried %UserProfile%
but since this is now running as the admin user account I get the home folder of the admin instead.
I tried changing the set params= %*
line to set params= "%UserProfile%" %*
so that it passes the path of the home folder in to the Administrator cmd instance as a parameter but the quotes make it crash for some reason. I need the quotes in case the normal user account name has a space in it.
How can I get this working?