start-process

running dos command line from C#?

落爺英雄遲暮 提交于 2019-11-27 17:53:55
问题 I am trying to run this command from command-line prompt: "D:\\fiji\\fiji.exe -macro D:\\fiji\\macros\\FFTBatch.ijm --headless" It works perfect when I type it in a command-line console. However, when I was trying to make it work from C# application, it failed. I tried following, but seems the command above did not get executed somehow: string fijiCmdText = "D:\\fiji\\fiji.exe -macro D:\\fiji\\macros\\FFTBatch.ijm --headless"; System.Diagnostics.Process.Start("cmd.exe", fijiCmdText); Anyone

Start non-elevated process from elevated process [duplicate]

安稳与你 提交于 2019-11-27 06:52:30
问题 Possible Duplicate: How to run NOT elevated in Vista (.NET) How do you de-elevate privileges for a child process My program running as an elevated process, and starting new processes with Process.Start() . For security reasons, I would like to run those new processes as non-elevated. How to do that? 回答1: Take a look at: How to run NOT elevated in Vista (.NET) The answer is presented at that URL. Also, you may want to read http://go.microsoft.com/fwlink/?LinkId=81232 for why this is not such a

PowerShell - Start-Process and Cmdline Switches

随声附和 提交于 2019-11-27 03:52:39
I can run this fine: $msbuild = "C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe" start-process $msbuild -wait But when I run this code (below) I get an error: $msbuild = "C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe /v:q /nologo" start-process $msbuild -wait Is there a way I can pass parameters to MSBuild using start-process? I'm open to not using start-process, the only reason I used it was I needed to have the "command" as a variable. When I have C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe /v:q /nologo on a line by itself, how does that get handled in Powershell? Should I

Capturing standard out and error with Start-Process

谁都会走 提交于 2019-11-26 00:37:17
问题 Is there a bug in PowerShell\'s Start-Process command when accessing the StandardError and StandardOutput properties? If I run the following I get no output: $process = Start-Process -FilePath ping -ArgumentList localhost -NoNewWindow -PassThru -Wait $process.StandardOutput $process.StandardError But if I redirect the output to a file I get the expected result: $process = Start-Process -FilePath ping -ArgumentList localhost -NoNewWindow -PassThru -Wait -RedirectStandardOutput stdout.txt

Capturing standard out and error with Start-Process

亡梦爱人 提交于 2019-11-25 19:09:29
Is there a bug in PowerShell's Start-Process command when accessing the StandardError and StandardOutput properties? If I run the following I get no output: $process = Start-Process -FilePath ping -ArgumentList localhost -NoNewWindow -PassThru -Wait $process.StandardOutput $process.StandardError But if I redirect the output to a file I get the expected result: $process = Start-Process -FilePath ping -ArgumentList localhost -NoNewWindow -PassThru -Wait -RedirectStandardOutput stdout.txt -RedirectStandardError stderr.txt Andy Arismendi That's how Start-Process was designed for some reason. Here