Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用powershell运行C#控制台应用程序_C#_Powershell_Console Application - Fatal编程技术网

如何使用powershell运行C#控制台应用程序

如何使用powershell运行C#控制台应用程序,c#,powershell,console-application,C#,Powershell,Console Application,我有一个C#控制台应用程序,可以读取.csv文件。我想在一个PuthScript脚本的中间运行。最好的方法是什么?简单: Start-Process -Wait PathToFile 如果不想等待进程完成,请卸下“-wait”开关。简单: Start-Process -Wait PathToFile 如果不想等待进程完成,请卸下“-wait”开关。简单: Start-Process -Wait PathToFile 如果不想等待进程完成,请卸下“-wait”开关。简单: Start-Pro

我有一个C#控制台应用程序,可以读取.csv文件。我想在一个PuthScript脚本的中间运行。最好的方法是什么?

简单:

Start-Process -Wait PathToFile
如果不想等待进程完成,请卸下“-wait”开关。

简单:

Start-Process -Wait PathToFile
如果不想等待进程完成,请卸下“-wait”开关。

简单:

Start-Process -Wait PathToFile
如果不想等待进程完成,请卸下“-wait”开关。

简单:

Start-Process -Wait PathToFile

如果不想等待进程完成,请删除“-wait”开关。

使用
启动进程
,或者使用
-PassThru
选项,例如:

$csvProc = Start-Process my_csv_reader.exe -PassThru
这将允许您稍后执行类似于
$csvProc |停止进程
的操作,或者通过
$csvProc.HasExited
检查它是否仍在脚本中的稍后点运行

如果你需要更多的控制,你可以这样做:

$csvProc = New-Object System.Diagnostics.ProcessStartInfo

然后,您可以使用
$csvProc
与在C#中使用ProcessStartInfo相同的方法(设置文件名、参数、重定向标准输入或输出、启动进程等)。

使用
启动进程
,可能使用
-PassThru
选项,例如:

$csvProc = Start-Process my_csv_reader.exe -PassThru
这将允许您稍后执行类似于
$csvProc |停止进程
的操作,或者通过
$csvProc.HasExited
检查它是否仍在脚本中的稍后点运行

如果你需要更多的控制,你可以这样做:

$csvProc = New-Object System.Diagnostics.ProcessStartInfo

然后,您可以使用
$csvProc
与在C#中使用ProcessStartInfo相同的方法(设置文件名、参数、重定向标准输入或输出、启动进程等)。

使用
启动进程
,可能使用
-PassThru
选项,例如:

$csvProc = Start-Process my_csv_reader.exe -PassThru
这将允许您稍后执行类似于
$csvProc |停止进程
的操作,或者通过
$csvProc.HasExited
检查它是否仍在脚本中的稍后点运行

如果你需要更多的控制,你可以这样做:

$csvProc = New-Object System.Diagnostics.ProcessStartInfo

然后,您可以使用
$csvProc
与在C#中使用ProcessStartInfo相同的方法(设置文件名、参数、重定向标准输入或输出、启动进程等)。

使用
启动进程
,可能使用
-PassThru
选项,例如:

$csvProc = Start-Process my_csv_reader.exe -PassThru
这将允许您稍后执行类似于
$csvProc |停止进程
的操作,或者通过
$csvProc.HasExited
检查它是否仍在脚本中的稍后点运行

如果你需要更多的控制,你可以这样做:

$csvProc = New-Object System.Diagnostics.ProcessStartInfo

然后,您可以像在C#中使用ProcessStartInfo一样使用
$csvProc
(设置文件名、参数、重定向标准输入或输出、启动进程等)。

如果您的可执行文件不在您的路径中,您需要告诉powershell在哪里可以找到它

& "c:\some path with spaces\foo.exe" <arguments go here>

&“c:\some path with spaces\foo.exe”

如果可执行文件不在路径中,则需要告诉powershell在哪里可以找到它

& "c:\some path with spaces\foo.exe" <arguments go here>

&“c:\some path with spaces\foo.exe”

如果可执行文件不在路径中,则需要告诉powershell在哪里可以找到它

& "c:\some path with spaces\foo.exe" <arguments go here>

&“c:\some path with spaces\foo.exe”

如果可执行文件不在路径中,则需要告诉powershell在哪里可以找到它

& "c:\some path with spaces\foo.exe" <arguments go here>

&“c:\some path with spaces\foo.exe”

谢谢大家的回复。我对这件事不熟悉,所以很抱歉重复这个问题。我试着寻找,但找不到我问题的答案。干杯谢谢大家的回复。我对这件事不熟悉,所以很抱歉重复这个问题。我试着寻找,但找不到我问题的答案。干杯谢谢大家的回复。我对这件事不熟悉,所以很抱歉重复这个问题。我试着寻找,但找不到我问题的答案。干杯谢谢大家的回复。我对这件事不熟悉,所以很抱歉重复这个问题。我试着寻找,但找不到我问题的答案。干杯