The program files directory in Vista is protected by default with UAC. Files can't be copied to a program files subdir without elevation of privelage.
I'm attempting to use copyfile and it silently fails to copy a file from source directory (happens to be desktop) to a folder in the program files directory.
I'm looking for a solution to get this work. [b]It is okay if the user is prompted for administrative elevation in order to get the file copy to work.[/b]
Installers write files to program files.... and Macro Scheduler is compatible with Vista... How can I put a file in the program files directory using MacroScheduler'?
How to copyfile to a Vista's program files sub directory?
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You can do one of:
a) Set Macro Scheduler to run as admin on startup
b) Run Macro Scheduler as admin when required.
c) Have Macro Scheduler run as normal but run an elevated script/exe/bat to do the copy, e.g.:
If you have Pro you can compile the copy script to an exe and simplify the above Run line.
In either case you can pass parms to the called .scp/.exe as usual, e.g.:
...do_copy.scp /SOURCEFILE=c:\whatever.txt /DEST=d:\
Of course if you're just doing a copy then you may just as well call the COPY command:
Using this final option means the bulk of your script can run as normal and only the part that needs to be run as admin is elevated. Which IMO is the correct way to do it.
a) Set Macro Scheduler to run as admin on startup
b) Run Macro Scheduler as admin when required.
c) Have Macro Scheduler run as normal but run an elevated script/exe/bat to do the copy, e.g.:
Code: Select all
Let>RP_ADMIN=1
Let>RP_WAIT=1
Run>"c:\program files\macro scheduler 11\msched.exe" "%SCRIPT_DIR%\do_copy.scp"
In either case you can pass parms to the called .scp/.exe as usual, e.g.:
...do_copy.scp /SOURCEFILE=c:\whatever.txt /DEST=d:\
Of course if you're just doing a copy then you may just as well call the COPY command:
Code: Select all
Let>RP_ADMIN=1
Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Run>cmd.exe /c copy "%sourcefile%" "%destfile%"
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
copy to %programfiles% - resolved
I was missing RP_ADMIN=1. This option didn't exist in version 9.
On version 11 it works brilliantly.
Thank you!
On version 11 it works brilliantly.
Thank you!