[英]How to run a command process with C#
我想用 C# 運行命令進程並查看 NodeJS 的版本
using (Process process = Process.Start(new ProcessStartInfo()
{
FileName="cmd.exe",
Arguments = "node -v"
}))
{
process.WaitForExit();
}
但我只看到一個沒有 NodeJS 版本的命令提示符,知道嗎? 謝謝
這對我有用。
using (Process process = Process.Start(new ProcessStartInfo()
{
FileName = "cmd.exe",
Arguments = "/C node -v",
}))
{
process.WaitForExit();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.