Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Process().start does not respect the environment

Process().start does not respect the environment

Scheduled Pinned Locked Moved C#
questionworkspace
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bbranded
    wrote on last edited by
    #1

    Hello, I'm not talking about Kyoto Protocol compliance... it appears that process().start does not respect the PATH environmental variable. This may be the way that the function works, however; I'm storing the exe that will be started in a path that is in the PATH and attempting to start() it withotu specifying a path. Is it possible to get start() to search the paths in the PATH variable and have no console window pop up? Apparently, the UseShellExecute property of startupinfo causes a console window to popup even if createnowindow is set to true. string ApplicationPath = ("desktopiconcmd.exe"); string ApplicationArguments = "save /y"; Process ProcessObj = new Process(); ProcessObj.StartInfo.FileName = ApplicationPath; ProcessObj.StartInfo.Arguments = ApplicationArguments; ProcessObj.StartInfo.UseShellExecute = true; ProcessObj.StartInfo.CreateNoWindow = true; ProcessObj.Start(); ProcessObj.WaitForExit(); Thanks, Matt

    B 1 Reply Last reply
    0
    • B bbranded

      Hello, I'm not talking about Kyoto Protocol compliance... it appears that process().start does not respect the PATH environmental variable. This may be the way that the function works, however; I'm storing the exe that will be started in a path that is in the PATH and attempting to start() it withotu specifying a path. Is it possible to get start() to search the paths in the PATH variable and have no console window pop up? Apparently, the UseShellExecute property of startupinfo causes a console window to popup even if createnowindow is set to true. string ApplicationPath = ("desktopiconcmd.exe"); string ApplicationArguments = "save /y"; Process ProcessObj = new Process(); ProcessObj.StartInfo.FileName = ApplicationPath; ProcessObj.StartInfo.Arguments = ApplicationArguments; ProcessObj.StartInfo.UseShellExecute = true; ProcessObj.StartInfo.CreateNoWindow = true; ProcessObj.Start(); ProcessObj.WaitForExit(); Thanks, Matt

      B Offline
      B Offline
      bbranded
      wrote on last edited by
      #2

      Problem solved: ProcessObj.StartInfo.LoadUserProfile = true[^] ProcessObj.StartInfo.UseShellExecute = false[^] string ApplicationPath = ("desktopiconcmd.exe"); string ApplicationArguments = "save /y"; Process ProcessObj = new Process(); ProcessObj.StartInfo.FileName = ApplicationPath; ProcessObj.StartInfo.Arguments = ApplicationArguments; ProcessObj.StartInfo.LoadUserProfile = true; ProcessObj.StartInfo.UseShellExecute = false; ProcessObj.StartInfo.CreateNoWindow = true; //ProcessObj.StartInfo.RedirectStandardOutput = true; //ProcessObj.StartInfo.RedirectStandardError = true; ProcessObj.Start(); ProcessObj.WaitForExit(); //StreamReader srOut = ProcessObj.StandardOutput; //string sOutput = srOut.ReadToEnd(); //srOut.Close(); //MessageBox.Show(sOutput);

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups