I have a powershell script that is in my startup:
%appdata%\Microsoft\Windows\Start Menu\Programs\Startup\
Note, the script itself is not in startup. Rather in \Startup\ is a shortcut to the script. The shortcut is to:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -NoProfile -File C:\develop\utils\powershell\converter.ps1
and it sits in a loop all day, waiting for events. This is the loop:
try {
# At the end of the script...
while ($true) {
Start-Sleep -Seconds .2
}
}
catch {}
Finally {
# Work with CTRL + C exit too !
Unregister-Event -SourceIdentifier $eventname
}
Works great.
But when I log in, there is that command box....
How do I get the script to be exactly what it is, but minimized? (Or even better,,, sit in the tray... but only if that is easy! What I mean here is: Ideally it wouldn't even be in my alt-tab window sequence... but I could terminate it if I needed to....)
I should further note that the script has to be in my user session, as the events it feeds from are triggered by me as I use other apps. (IOW: Putting it in task scheduler is not an option.)