Using scripts on Win7

Disk backup and restore, partition imaging and cloning, and drive copy using R-Drive Image.
Forum rules
Discussion on the R-Drive Image software
MerleOne
Posts: 71
Joined: Fri Jan 30, 2009 12:11 pm

Using scripts on Win7

Post by MerleOne » Fri Dec 09, 2011 3:25 am

Hi,
I have created some scripts on my Win7 machine, but they need to be elevated to run properly or launched from an elevated cmd window. Is there a nice way to have them ask for elevation when launched ? Because it is rather cumbersome to manually launch an elevated cmd, then manually to the folder where they are then launch them. When I simply double-click on them using the explorer, there is no elevation and the image fails (it still creates a 2kb file which I have to clear in the backup folder).
Thanks.

Alt
Site Moderator
Posts: 3129
Joined: Tue Nov 11, 2008 2:13 pm
Contact:

Re: Using scripts on Win7

Post by Alt » Sat Dec 10, 2011 4:08 am

Right-click a bat file with the script and select Run as Administrator. A prompt will appear asking you to confirm that and the file will start with elevated privileges. If you're an administrator, of course.

MerleOne
Posts: 71
Joined: Fri Jan 30, 2009 12:11 pm

Re: Using scripts on Win7

Post by MerleOne » Sat Dec 10, 2011 5:27 am

Thanks. I have done the following :
- created a script "mybackup.rdi" in C:\Scripts\
- created a .bat file containing
start "" c:\scripts\mybackup.rdi

Now, when I right-click on the .bat file within the explorer, and chose run as admin, it does work.

Next step is to have the same functionality using double-click, maybe by creating a shortcut to the .bat file.

Post Reply