Add cd-autostart.ps1

This commit is contained in:
Markus Fleschutz
2021-10-19 07:59:19 +02:00
parent 1bb7b22b27
commit 840dd7f3cc
5 changed files with 88 additions and 37 deletions

22
Scripts/cd-autostart.ps1 Executable file
View File

@ -0,0 +1,22 @@
<#
.SYNOPSIS
Sets the working directory to the user's autostart folder
.DESCRIPTION
This script changes the working directory to the user's autostart folder.
.EXAMPLE
PS> ./cd-autostart
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz · License: CC0
#>
$TargetDir = resolve-path "$HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Autostart"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, the user's autostart folder at 📂$TargetDir does not exist (yet)"
exit 1
}
set-location "$TargetDir"
"📂$TargetDir"
exit 0 # success