Prev: CDO.Message authentication??
Next: Code-Completition
From: Thomas Steinbach on 6 Jan 2010 10:56 Hello, I would like to call a batchfile within the elevate.cmd/vbs scripts found at [1]. But I have a problem within that combination of cmd/vbs script(s) I'm in a path like: "C:\Program Files\Best Prog" and have there a batchfile "mybatch.bat". I also have somewhere in the searchpath a batchfile svctest.bat that looks like: ---snip--- net start | findstr /C:%~1 >nul if ERRORLEVEL 1 goto END if ERRORLEVEL 0 goto SVCACTION :SVCACTION elevate mybatch.bat "%~f1" :END ---snap--- But if my script mybatch.bat is called from that dir but through svctest.bat. wich calls the elevate.cmd/vbs script, the wscipt/cscript changes the active directory to the %SystemRoot% (tested in mybatch with %CD%) and my batchfile won't work. How can I change to or reside in the active diretory from where I called my batchfile mybatch.bat with svctest.bat (which will reside in an another direcotry, eventually)? Would be good if I don't have to change the directory with the called mybatch.bat file First I tried to introduce a new var in elevate.cmd set ELEVATE_PATH=%CD% then I could use: strAppPath = objWshProcessEnv("ELEVATE_PATH") in the elevate.vbs script to have the path in the vbs script. But a line like: objWshShell.CurrentDirectory = strAppPath before the execution of the line objShell.ShellExecute strApplication, strArguments, "", "runas" doesn't help and even to set the path like: objShell.ShellExecute strApplication, strArguments, strAppPath, "runas" doesnt work :-( Does anybody has an idea how to achieve that? Thomas [1] http://technet.microsoft.com/en-us/magazine/2008.06.elevation.aspx
|
Pages: 1 Prev: CDO.Message authentication?? Next: Code-Completition |