M
Michael A. Covington
Guest
I'm trying to port to Vista a large set of software installation scripts
(.BAT files) that we've been using with XP and earlier versions, and the
following thing is driving me batty:
Whenever a .BAT file is elevated (to use administrator privileges), it loses
track of its working directory and instead runs in %windir%\system32.
That means it can no longer locate the files that are in the directory with
it.
I've tried elevation by right-clicking and choosing "Run As Administrator,"
and also by using the "runas" verb argument of ShellExecute in JScript.
Both give the same result. Passing ShellExecute a directory argument
doesn't help.
Is there any way to elevate (in order to be able to write in
%allusersprofile%) without losing track of the working directory? The main
thing we need to do in the scripts that is tricky is move around some of the
items on the Start Menu. Maybe there is a separate utility for munging the
Start Menu?
(.BAT files) that we've been using with XP and earlier versions, and the
following thing is driving me batty:
Whenever a .BAT file is elevated (to use administrator privileges), it loses
track of its working directory and instead runs in %windir%\system32.
That means it can no longer locate the files that are in the directory with
it.
I've tried elevation by right-clicking and choosing "Run As Administrator,"
and also by using the "runas" verb argument of ShellExecute in JScript.
Both give the same result. Passing ShellExecute a directory argument
doesn't help.
Is there any way to elevate (in order to be able to write in
%allusersprofile%) without losing track of the working directory? The main
thing we need to do in the scripts that is tricky is move around some of the
items on the Start Menu. Maybe there is a separate utility for munging the
Start Menu?