mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 13:04:59 +02:00
Add cd-autostart.ps1
This commit is contained in:
22
Scripts/cd-autostart.ps1
Executable file
22
Scripts/cd-autostart.ps1
Executable 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
|
Reference in New Issue
Block a user