Safe place to put an executable file on Windows 7 (and Windows XP)
Posted
by
Ricket
on Server Fault
See other posts from Server Fault
or by Ricket
Published on 2011-03-11T18:33:03Z
Indexed on
2011/03/12
8:11 UTC
Read the original article
Hit count: 405
I'm working on a tweak to our logon script which will copy an executable file to the local hard drive and then, using the schtasks
command, schedule a task to run that executable daily.
It's a standalone executable file, and when run it creates a folder in the working directory (which would be the same directory as the executable in this case). In Windows XP, of course, it can be put anywhere - I'd probably just throw it in C:\SomeRandomFolder and let it be. But this logon script also runs on Windows 7 64-bit machines, and those are trickier with UAC and all that.
The user is a local administrator but UAC is enabled, so I'm pretty sure that the executable would be blocked from copying to a location like C:\
or C:\Program Files
(since those seem to be at least mildly protected by UAC). The scheduled task needs to run under the user's profile, so I can't just run it with SYSTEM and ignore the UAC boundaries; I need to find a path which the user can copy into.
Where can I copy this standalone executable file, so that the copy operation succeeds without a UAC prompt on Windows 7, the path is either common to both WinXP and Win7 or uses environment variables, and the scheduled task running with user permissions is able to launch the executable?
© Server Fault or respective owner