Add close-notepad-app.ps1 and minimize-notepad-app.ps1

This commit is contained in:
Markus Fleschutz 2021-11-23 22:03:30 +01:00
parent ce5311e427
commit 6f1b4bbcd7
3 changed files with 36 additions and 2 deletions

19
Scripts/close-notepad-app.ps1 Executable file
View File

@ -0,0 +1,19 @@
<#
.SYNOPSIS
Closes the Notepad app
.DESCRIPTION
This script closes the Notepad application gracefully.
.EXAMPLE
PS> ./close-notepad-app
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
TaskKill /im Notepad
if ($lastExitCode -ne "0") {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Notepad is already closed."
exit 1
}
exit 0 # success

View File

@ -0,0 +1,15 @@
<#
.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

View File

@ -1,10 +1,10 @@
<#
.SYNOPSIS
Starts Notepad
Launches the Notepad app
.DESCRIPTION
This script launches the Notepad application.
.EXAMPLE
PS> ./open-notepad
PS> ./open-notepad-app
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK