0

Everything else but Spotify starts up hidden. (Spotify is downloaded from the Microsoft Store) I only wrote "spotify.exe" at Process.Start(); because it was in the 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();
}
Milo
  • 3,365
  • 9
  • 30
  • 44
Akın
  • 36
  • 4
  • So it is seems it's not C# but Spotify which ignores the flag, or?. – Klaus Gütter Dec 05 '19 at 13:39
  • Yeah that seems to be the case but I don't understand why that would be the case... – Akın Dec 05 '19 at 14:08
  • The WindowStyle given is passed to the application's `WinMain`. What the application does with this value, is not under your control. See also https://stackoverflow.com/questions/5094003/net-windowstyle-hidden-vs-createnowindow-true – Klaus Gütter Dec 06 '19 at 05:48

0 Answers0