![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Starting VS IDE with WSH causes catastrophic process failure Hope this is the right forum; if not please point me in the right direction. NOTE: I am also posting this in microsoft.public.vsnet.general. Goal: Configure an environment variable that may change depending on which branch of the source tree I am working on, then start Visual Studio IDE. If I attempt to use Computer > Properties > Advanced > Environment Variables, I will be changing it many times a day, because I am working in multiple branches of our source. Hence I am trying to write a WSH script to accomplish this purpose. Script: Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!"_ & "\\.\root\cimv2") Set objStartup = objWMIService.Get("Win32_ProcessStartup") Set objConfig = objStartup.SpawnInstance_ objConfig.EnvironmentVariables("UnitTestingValues") _ = "C:\Utils\MyDir\UnitTestingValues.xml" objConfig.ShowWindow = SW_NORMAL Set objProcess = objWMIService.Get("Win32_Process") objProcess.Create "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe", "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\", objConfig, intProcessID Result: The VS IDE starts. I open a solution that contains a unit testing project. When I attempt to open Test View, the process crashes catastrophically--i.e., it just disappears without leaving a trace. When I open the same solution by just clicking the VS 2008 icon and then go thru the same steps, I am able to open Test View and run tests without a problem. (They just don't work because the environment variable is not set the way it needs to be.) Additional Info: I have also tried using the Win32_ProcessStartup object directly, without spawning a new instance. Set objConfig = objWMIService.Get("Win32_ProcessStartup") objConfig.EnvironmentVariables("UnitTestingValues") = "C:\Utils\Scripts\Cassi\UnitTestingValues.xml" objConfig.ShowWindow = SW_NORMAL Set objProcess = objWMIService.Get("Win32_Process") objProcess.Create 'etcetera... The result is the same, unfortunately. Is there a better way for me to set environment variables when starting a new process? If I use simple *.cmd files, the devenv.exe process that gets started does not inherit the parent process' environment variables, unfortunately. TIA - -- Chris |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Starting VS IDE with WSH causes catastrophic process failure Additional info: The VS IDE behavior changes when I omit the line of script that sets the environment variable (objConfig.EnvironmentVariables("UnitTestingValues") = "C:\MyDir\MyFile.xml"). Instead of crashing, the IDE *hangs* when I attempt to open Test View window... -- Chris "Chris" wrote: Quote: > Hope this is the right forum; if not please point me in the right direction. > NOTE: I am also posting this in microsoft.public.vsnet.general. > > Goal: Configure an environment variable that may change depending on which > branch of the source tree I am working on, then start Visual Studio IDE. If > I attempt to use Computer > Properties > Advanced > Environment Variables, I > will be changing it many times a day, because I am working in multiple > branches of our source. Hence I am trying to write a WSH script to > accomplish this purpose. > > Script: > Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!"_ > & "\\.\root\cimv2") > Set objStartup = objWMIService.Get("Win32_ProcessStartup") > Set objConfig = objStartup.SpawnInstance_ > objConfig.EnvironmentVariables("UnitTestingValues") _ > = "C:\Utils\MyDir\UnitTestingValues.xml" > objConfig.ShowWindow = SW_NORMAL > Set objProcess = objWMIService.Get("Win32_Process") > objProcess.Create "C:\Program Files\Microsoft Visual Studio > 9.0\Common7\IDE\devenv.exe", "C:\Program Files\Microsoft Visual Studio > 9.0\Common7\IDE\", objConfig, intProcessID > > Result: The VS IDE starts. I open a solution that contains a unit testing > project. When I attempt to open Test View, the process crashes > catastrophically--i.e., it just disappears without leaving a trace. > > When I open the same solution by just clicking the VS 2008 icon and then go > thru the same steps, I am able to open Test View and run tests without a > problem. (They just don't work because the environment variable is not set > the way it needs to be.) > > Additional Info: I have also tried using the Win32_ProcessStartup object > directly, without spawning a new instance. > > Set objConfig = objWMIService.Get("Win32_ProcessStartup") > objConfig.EnvironmentVariables("UnitTestingValues") = > "C:\Utils\Scripts\Cassi\UnitTestingValues.xml" > objConfig.ShowWindow = SW_NORMAL > Set objProcess = objWMIService.Get("Win32_Process") > objProcess.Create 'etcetera... > > The result is the same, unfortunately. > > Is there a better way for me to set environment variables when starting a > new process? If I use simple *.cmd files, the devenv.exe process that gets > started does not inherit the parent process' environment variables, > unfortunately. > > TIA - > -- > Chris |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| catastrophic failure 0x8000FFFF | General Discussion | |||
| Catastrophic failure 0x8000FFFF | Live Messenger | |||
| Catastrophic Failure? | Vista installation & setup | |||
| Catastrophic Failure | Vista General | |||
| Re: Catastrophic Failure: Catastrophic Failure Complete PC Backup Info | Vista General | |||