G
Guest
Hi -
I have to distribute a batch file to many Vista and XP users in our
organization, which will dump a 16 bit app onto the local hard drive and
create shortcuts to it on the Desktop and Start Menu. I would prefer that
the program folder be copied to Program Files and that a shortcut be copied
to the %AllUsersProfile% Desktop and Start Menu. All of the users will be
installing it on their personally owned laptops so they almost certainly will
have Admin rights.
The problem is that when I tried this on a couple of computers using an
account with Admin rights, it worked like a charm. But when I tried it on a
third, I found that it prompted for elevation. (All of these machines have
UAC turned on.) I don't think there is a way to elevate within a batch file,
so I tried right clicking the batch file and choosing "Run as Administrator".
Then because it was running under a different account, I lost my working
directory and the batch file was not able to find the files it needed to
copy. (I can't use an absolute path to the source files in the batch file,
since I can't assume the directory that users will be running this from.) I
ended up changing the batch file so that everything was copied to the user's
own profile, since I don't know how many other Vista machines will have this
same problem.
Can someone explain why I would be prompted to elevate when trying to copy
these files on some machine but not others? I'm not sure what I'm missing.
Thanks.
I have to distribute a batch file to many Vista and XP users in our
organization, which will dump a 16 bit app onto the local hard drive and
create shortcuts to it on the Desktop and Start Menu. I would prefer that
the program folder be copied to Program Files and that a shortcut be copied
to the %AllUsersProfile% Desktop and Start Menu. All of the users will be
installing it on their personally owned laptops so they almost certainly will
have Admin rights.
The problem is that when I tried this on a couple of computers using an
account with Admin rights, it worked like a charm. But when I tried it on a
third, I found that it prompted for elevation. (All of these machines have
UAC turned on.) I don't think there is a way to elevate within a batch file,
so I tried right clicking the batch file and choosing "Run as Administrator".
Then because it was running under a different account, I lost my working
directory and the batch file was not able to find the files it needed to
copy. (I can't use an absolute path to the source files in the batch file,
since I can't assume the directory that users will be running this from.) I
ended up changing the batch file so that everything was copied to the user's
own profile, since I don't know how many other Vista machines will have this
same problem.
Can someone explain why I would be prompted to elevate when trying to copy
these files on some machine but not others? I'm not sure what I'm missing.
Thanks.