I have a relatively simple request: I have a small script that I want to be able to paste into the "run" dialogue of Windows to download and install the Steam installer. It downloads the executable from the official website to the user's %temp% and executes it once the download has finished.
PowerShell.exe -command (new-object System.Net.WebClient).DownloadFile('https://steamcdn-a.akamaihd.net/client/installer/SteamSetup.exe','%TEMP%\steam.exe');Start-Process "%TEMP%\steam.exe"
However, I would also like to hide the PowerShell window that is spawned. I looked this up and found the -windowstyle argument, which, when set to "hidden", should do what I want. However, after adding this tag, the download part of the initial function still works, but the installer is no longer executed when the download finishes. What am I doing wrong?