I have a script that uses WMI to launch an executable. However, the only thing that I can get it to launch is items within the %systemroot%. I have tried to set the working directory to something else, but it produces the same result. How can I get it to launch an application outside of the %systemroot%?
Code:
Set oProcess = GetObject("winmgmts:Win32_Process")
Set oInParams = oProcess.Methods_("Create").InParameters.SpawnInstance_
oInParams.CommandLine = "gt.exe"
oInParams.CurrentDirectory = "c:\temp"
set RetObj = oProcess.ExecMethod_("Create", oInParams,null)