Update close-notepad-app.ps1

This commit is contained in:
Markus Fleschutz 2021-11-23 22:12:27 +01:00
parent 6f1b4bbcd7
commit c754bae0bf
4 changed files with 2 additions and 22 deletions

View File

@ -28,7 +28,7 @@ Computer, open `name` browser
Computer, open `name` app
--------------------------
* this launches the given application.
* replace `name` by: "Calculator", "Git Extensions", "Netflix", "Spotify", "Thunderbird", or "Visual Studio".
* replace `name` by: "Calculator", "Git Extensions", "Netflix", "Notepad", "Spotify", "Thunderbird", or "Visual Studio".
* when finished use: *Computer, close `name` app* to stop the application.

View File

@ -11,9 +11,5 @@
https://github.com/fleschutz/PowerShell
#>
TaskKill /im Notepad
if ($lastExitCode -ne "0") {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Notepad is already closed."
exit 1
}
& "$PSScriptRoot/close-program.ps1" "Notepad" "notepad" "notepad"
exit 0 # success

View File

@ -36,7 +36,6 @@ try {
start-sleep -milliseconds 100
stop-process -name $ProgramName -force -errorAction 'silentlycontinue'
} else {
$Processes = get-process -name $ProgramAliasName -errorAction 'silentlycontinue'
if ($Processes.Count -eq 0) {
throw "$FullProgramName is not started yet"

View File

@ -1,15 +0,0 @@
<#
.SYNOPSIS
Minimizes the Notepad app
.DESCRIPTION
This script minimizes the Notepad application.
.EXAMPLE
PS> ./minimize-notepad-app
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
get-process Notepad | Set-WindowStyle -Style Minimize
exit 0 # success