Path defaults to c:\windows\system32 when using Run as Administrator

N

Nick Payne

A have a couple of backup cmd files using relative paths. If I double-click
on them in Windows Explorer then they run using as the default path the
location of the cmd file, which is what I want. This worked fine on XP, but
on Vista I have to run the cmd files as administrator for some of the copies
to succeed. However, if I right-click on the cmd file and select "run as
administrator", it seems to use the default path of c:\windows\system32
rather than the cmd file location, because I find that files are getting
copied to paths under c:\windows\system32 rather than under the location of
the cmd file.

I don't want to put in absolute paths because the cmd files are located on
and the copies are to external USB drives that don't always have the same
drive letter. Is there a solution to the problem other than running a cmd
window as administrator, changing path in the cmd window to the external
drive, and running the cmd file that way - this is hardly a user interface
improvement over XP.

Nick
 
R

R. C. White

Hi, Nick.

Your post is nearly a month old and you may have already solved your
problem. If not, maybe I can help with a couple of comments.

This is a job for Disk Management, it seems to me.
and the copies are to external USB drives that don't always have the same
drive letter.

I've never used USB hard drives, but I have several USB flash drives (and a
USB SD card reader). If I don't assign my choice of letters, then Vista
assigns "the next available letter" each time I plug them in. So I've
assigned letters for them in Disk Management and they get the same letters
when I unplug them and plug them in again. In other words, my ReadyBoost
drive is always R:; my SD card reader is always S:.

I've assigned the often-overlooked letter B: to a USB flash drive that I use
to back up some small-but-critical files. I don't use a backup program, but
a batch file, which I think is what you are using. I've created and edited
the WeekBat.bat file with Notepad and stored it on Drive B:. It has
instructions to Xcopy specific files and folders from my hard drives to
specific places on Drive B:. Each week, I plug in the USB drive, navigate
to B:\WeekBak.bat and click on it. When it is done, I unplug Drive B: and
put it back in the safe. My 8 GB flash drive has about 6 GB free now.

You didn't say how big your files are, or how many different locations are
involved, but this might give you some ideas that you can adapt to your own
situation.

RC
--
R. C. White, CPA
San Marcos, TX
(e-mail address removed)
Microsoft Windows MVP
(Running Windows Live Mail 2008 0908 in Win7 x64 6801)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top