This command will loop until the process no longer exists, calling closemainwindow() this is as if the user clicked the close window x in the upper right hand corner and gives the user an opportunity to save work in many applications like notepad and other things. The $'s are escaped for Cygwin, if you want to run the same command from the RUN box or cmd.exe shell then just unescape the $'s: powershell -Command "while ($true){Try{$process=Get-Process calc -ErrorAction Stop}Catch [Microsoft.PowerShell.Commands.ProcessCommandException]{break;}if ($process) {$whateva=$process.CloseMainWindow()}else {break;}Start-Sleep -m 500}" Show Sample Output
Tested on Windows 8 w/SSH, Cygwin - it can be tricky to quote if you dont use the $(..) syntax to echo it back out Show Sample Output
Good for when you download youtube videos and want the mp3 for your mp3 player.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: