有沒有辦法將字符串參數傳遞給從我自己的進程中產生的進程。如何將參數傳遞給進程
我有我的主要應用:
Process.Start(Path.Combine(Application.StartupPath, "wow.exe");
wow.exe
是另一個應用程序我創建。我需要傳遞參數給這個exe(一個字符串)。我怎樣才能做到這一點?
我的嘗試:
ProcessStartInfo i = new //........
i.Argument = "cool string";
i. FileName = Path.Combine(Application.StartupPath, "wow.exe");
Process.Start(i);
,並在主wow
應用我寫道:
static void Main()
{
//print Process.GetCurrentProcess().StartInfo.Argument;
}
但我從來沒有得到我的字符串中有第二個應用程序的主。 Here is a question,詢問why
,但沒有how to solve it
..
編輯:Environment.GetCommandLineArgs()[1]
,它必須是。儘管如此,它的工作。接受@巴厘島的答案,他首先與這個答案齊聚一堂。感謝所有
ARGS []傳遞的參數?如何獲得? – nawfal
我在Main()中看不到任何類似的東西。 – nawfal
@nawfal:現在檢查 –