C#忽略“ ProcessWindowStyle.Hidden;”吗?

时间:2019-12-05 13:35:05

标签: c# process window spotify process.start

除Spotify之外的所有其他东西都开始隐藏。 (Spotify是从Microsoft Store下载的) 我只在Process.Start();上写了“ spotify.exe”,因为它在PATH中。

static void performanceMode()
{
    //Hide Console
    Process process = new Process();
    ProcessStartInfo startInfo = new ProcessStartInfo();
    process.StartInfo = startInfo;
    startInfo.WindowStyle = ProcessWindowStyle.Hidden;

    startInfo.FileName = "cmd.exe"; //Starts hidden.
    startInfo.Arguments = "/C powercfg /s 0776b752-5add-4983-8d52-f7370e479b36";

    process.Start();
    startInfo.Arguments = "";

    startInfo.FileName = "spotify.exe"; //Doesn't start hidden.
    process.Start();

    startInfo.FileName = "C:\\Program Files (x86)\\Skillbrains\\lightshot\\Lightshot.exe"; //Starts hidden.
    process.Start();

    startInfo.FileName = "C:\\Program Files\\LGHUB\\lghub.exe"; //Starts hidden.
    process.Start();

}

static void Main(string[] args)
{
    performanceMode();
}

0 个答案:

没有答案