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

View File

@ -3,24 +3,25 @@ add-firewall-rules.ps1, Adds firewall rules to the given executables (needs admi
add-memo.ps1, Adds the given memo text to $HOME/Memos.csv
build-repo.ps1, Builds a Git repository
build-repos.ps1, Builds all Git repositories in a folder
cd-desktop.ps1, Change the working directory to the user's desktop folder
cd-docs.ps1, Change the working directory to the user's documents folder
cd-downloads.ps1, Change the working directory to the user's downloads folder
cd-dropbox.ps1, Change the working directory to the user's Dropbox folder
cd-home.ps1, Change the working directory to the user's home folder
cd-music.ps1, Change the working directory to the user's music folder
cd-onedrive.ps1, Change the working directory to the user's OneDrive folder
cd-pics.ps1, Change the working directory to the user's pictures folder
cd-recycle-bin.ps1, Change the working directory to the user's recycle bin folder
cd-repos.ps1, Change the working directory to the user's Git repositories folder
cd-root.ps1, Change the working directory to the root directory (C: on Windows)
cd-scripts.ps1, Change the working directory to the PowerShell Scripts folder
cd-ssh.ps1, Change the working directory to the user's SSH folder
cd-up.ps1, Change the working directory to one directory level up
cd-up2.ps1, Change the working directory to two directory levels up
cd-up3.ps1, Change the working directory to three directory levels up
cd-up4.ps1, Change the working directory to four directory levels up
cd-videos.ps1, Change the working directory to the user's videos folder
cd-autostart.ps1, Set the working directory to the user's autostart folder
cd-desktop.ps1, Set the working directory to the user's desktop folder
cd-docs.ps1, Set the working directory to the user's documents folder
cd-downloads.ps1, Set the working directory to the user's downloads folder
cd-dropbox.ps1, Set the working directory to the user's Dropbox folder
cd-home.ps1, Set the working directory to the user's home folder
cd-music.ps1, Set the working directory to the user's music folder
cd-onedrive.ps1, Set the working directory to the user's OneDrive folder
cd-pics.ps1, Set the working directory to the user's pictures folder
cd-recycle-bin.ps1, Set the working directory to the user's recycle bin folder
cd-repos.ps1, Set the working directory to the user's Git repositories folder
cd-root.ps1, Set the working directory to the root directory (C: on Windows)
cd-scripts.ps1, Set the working directory to the PowerShell Scripts folder
cd-ssh.ps1, Set the working directory to the user's SSH folder
cd-up.ps1, Set the working directory to one directory level up
cd-up2.ps1, Set the working directory to two directory levels up
cd-up3.ps1, Set the working directory to three directory levels up
cd-up4.ps1, Set the working directory to four directory levels up
cd-videos.ps1, Set the working directory to the user's videos folder
check-cpu-temp.ps1, Checks the CPU temperature
check-dns-resolution.ps1, Checks the DNS resolution with frequently used domain names
check-drive-space.ps1, Checks a drive for free space left

1 Script Description
3 add-memo.ps1 Adds the given memo text to $HOME/Memos.csv
4 build-repo.ps1 Builds a Git repository
5 build-repos.ps1 Builds all Git repositories in a folder
6 cd-desktop.ps1 cd-autostart.ps1 Change the working directory to the user's desktop folder Set the working directory to the user's autostart folder
7 cd-docs.ps1 cd-desktop.ps1 Change the working directory to the user's documents folder Set the working directory to the user's desktop folder
8 cd-downloads.ps1 cd-docs.ps1 Change the working directory to the user's downloads folder Set the working directory to the user's documents folder
9 cd-dropbox.ps1 cd-downloads.ps1 Change the working directory to the user's Dropbox folder Set the working directory to the user's downloads folder
10 cd-home.ps1 cd-dropbox.ps1 Change the working directory to the user's home folder Set the working directory to the user's Dropbox folder
11 cd-music.ps1 cd-home.ps1 Change the working directory to the user's music folder Set the working directory to the user's home folder
12 cd-onedrive.ps1 cd-music.ps1 Change the working directory to the user's OneDrive folder Set the working directory to the user's music folder
13 cd-pics.ps1 cd-onedrive.ps1 Change the working directory to the user's pictures folder Set the working directory to the user's OneDrive folder
14 cd-recycle-bin.ps1 cd-pics.ps1 Change the working directory to the user's recycle bin folder Set the working directory to the user's pictures folder
15 cd-repos.ps1 cd-recycle-bin.ps1 Change the working directory to the user's Git repositories folder Set the working directory to the user's recycle bin folder
16 cd-root.ps1 cd-repos.ps1 Change the working directory to the root directory (C: on Windows) Set the working directory to the user's Git repositories folder
17 cd-scripts.ps1 cd-root.ps1 Change the working directory to the PowerShell Scripts folder Set the working directory to the root directory (C: on Windows)
18 cd-ssh.ps1 cd-scripts.ps1 Change the working directory to the user's SSH folder Set the working directory to the PowerShell Scripts folder
19 cd-up.ps1 cd-ssh.ps1 Change the working directory to one directory level up Set the working directory to the user's SSH folder
20 cd-up2.ps1 cd-up.ps1 Change the working directory to two directory levels up Set the working directory to one directory level up
21 cd-up3.ps1 cd-up2.ps1 Change the working directory to three directory levels up Set the working directory to two directory levels up
22 cd-up4.ps1 cd-up3.ps1 Change the working directory to four directory levels up Set the working directory to three directory levels up
23 cd-videos.ps1 cd-up4.ps1 Change the working directory to the user's videos folder Set the working directory to four directory levels up
24 cd-videos.ps1 Set the working directory to the user's videos folder
25 check-cpu-temp.ps1 Checks the CPU temperature
26 check-dns-resolution.ps1 Checks the DNS resolution with frequently used domain names
27 check-drive-space.ps1 Checks a drive for free space left

27
Docs/cd-autostart.md Normal file
View File

@ -0,0 +1,27 @@
## cd-autostart.ps1 - Sets the working directory to the user's autostart folder
This script changes the working directory to the user's autostart folder.
## Parameters
```powershell
cd-autostart.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
## Example
```powershell
PS> ./cd-autostart
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
```
## Notes
Author: Markus Fleschutz · License: CC0
## Related Links
https://github.com/fleschutz/PowerShell
*Generated by convert-ps2md.ps1 using the comment-based help of cd-autostart.ps1*

View File

@ -17,8 +17,8 @@ PS> ./list-console-colors
Name Foreground Background
---- ---------- ----------
Color As Foreground As Background
----- ------------- -------------
...
```

View File

@ -127,24 +127,25 @@ Mega Collection of PowerShell Scripts
| Script | Description | Help |
| ---------------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------- |
| [cd-desktop.ps1](Scripts/cd-desktop.ps1) | Change the working directory to the user's desktop folder | [Help](Docs/cd-desktop.md) |
| [cd-docs.ps1](Scripts/cd-docs.ps1) | Change the working directory to the user's documents folder | [Help](Docs/cd-docs.md) |
| [cd-downloads.ps1](Scripts/cd-downloads.ps1) | Change the working directory to the user's downloads folder | [Help](Docs/cd-downloads.md) |
| [cd-dropbox.ps1](Scripts/cd-dropbox.ps1) | Change the working directory to the user's Dropbox folder | [Help](Docs/cd-dropbox.md) |
| [cd-home.ps1](Scripts/cd-home.ps1) | Change the working directory to the user's home folder | [Help](Docs/cd-home.md) |
| [cd-music.ps1](Scripts/cd-music.ps1) | Change the working directory to the user's music folder | [Help](Docs/cd-music.md) |
| [cd-onedrive.ps1](Scripts/cd-onedrive.ps1) | Change the working directory to the user's OneDrive folder | [Help](Docs/cd-onedrive.md) |
| [cd-pics.ps1](Scripts/cd-pics.ps1) | Change the working directory to the user's pictures folder | [Help](Docs/cd-pics.md) |
| [cd-recycle-bin.ps1](Scripts/cd-recycle-bin.ps1) | Change the working directory to the user's recycle bin folder | [Help](Docs/cd-recycle-bin.md) |
| [cd-autostart.ps1](Scripts/cd-autostart.ps1) | Set the working directory to the user's autostart folder | [Help](Docs/cd-autostart.md) |
| [cd-desktop.ps1](Scripts/cd-desktop.ps1) | Set the working directory to the user's desktop folder | [Help](Docs/cd-desktop.md) |
| [cd-docs.ps1](Scripts/cd-docs.ps1) | Set the working directory to the user's documents folder | [Help](Docs/cd-docs.md) |
| [cd-downloads.ps1](Scripts/cd-downloads.ps1) | Set the working directory to the user's downloads folder | [Help](Docs/cd-downloads.md) |
| [cd-dropbox.ps1](Scripts/cd-dropbox.ps1) | Set the working directory to the user's Dropbox folder | [Help](Docs/cd-dropbox.md) |
| [cd-home.ps1](Scripts/cd-home.ps1) | Set the working directory to the user's home folder | [Help](Docs/cd-home.md) |
| [cd-music.ps1](Scripts/cd-music.ps1) | Set the working directory to the user's music folder | [Help](Docs/cd-music.md) |
| [cd-onedrive.ps1](Scripts/cd-onedrive.ps1) | Set the working directory to the user's OneDrive folder | [Help](Docs/cd-onedrive.md) |
| [cd-pics.ps1](Scripts/cd-pics.ps1) | Set the working directory to the user's pictures folder | [Help](Docs/cd-pics.md) |
| [cd-recycle-bin.ps1](Scripts/cd-recycle-bin.ps1) | Set the working directory to the user's recycle bin folder | [Help](Docs/cd-recycle-bin.md) |
| [cd-repos.ps1](Scripts/cd-repos.ps1) | Change the working directory to the user's Git repositories folder | [Help](Docs/cd-repos.md) |
| [cd-root.ps1](Scripts/cd-root.ps1) | Change the working directory to the root directory (C:\ on Windows)| [Help](Docs/cd-root.md) |
| [cd-scripts.ps1](Scripts/cd-scripts.ps1) | Change the working directory to the PowerShell Scripts folder | [Help](Docs/cd-scripts.md) |
| [cd-ssh.ps1](Scripts/cd-ssh.ps1) | Change the working directory to the user's SSH folder | [Help](Docs/cd-ssh.md) |
| [cd-up.ps1](Scripts/cd-up.ps1) | Change the working directory to one directory level up | [Help](Docs/cd-up.md) |
| [cd-up2.ps1](Scripts/cd-up2.ps1) | Change the working directory to two directory levels up | [Help](Docs/cd-up2.md) |
| [cd-up3.ps1](Scripts/cd-up3.ps1) | Change the working directory to three directory levels up | [Help](Docs/cd-up3.md) |
| [cd-up4.ps1](Scripts/cd-up4.ps1) | Change the working directory to four directory levels up | [Help](Docs/cd-up4.md) |
| [cd-videos.ps1](Scripts/cd-videos.ps1) | Change the working directory to the user's videos folder | [Help](Docs/cd-videos.md) |
| [cd-root.ps1](Scripts/cd-root.ps1) | Set the working directory to the root directory (C:\ on Windows) | [Help](Docs/cd-root.md) |
| [cd-scripts.ps1](Scripts/cd-scripts.ps1) | Set the working directory to the PowerShell Scripts folder | [Help](Docs/cd-scripts.md) |
| [cd-ssh.ps1](Scripts/cd-ssh.ps1) | Set the working directory to the user's SSH folder | [Help](Docs/cd-ssh.md) |
| [cd-up.ps1](Scripts/cd-up.ps1) | Set the working directory to one directory level up | [Help](Docs/cd-up.md) |
| [cd-up2.ps1](Scripts/cd-up2.ps1) | Set the working directory to two directory levels up | [Help](Docs/cd-up2.md) |
| [cd-up3.ps1](Scripts/cd-up3.ps1) | Set the working directory to three directory levels up | [Help](Docs/cd-up3.md) |
| [cd-up4.ps1](Scripts/cd-up4.ps1) | Set the working directory to four directory levels up | [Help](Docs/cd-up4.md) |
| [cd-videos.ps1](Scripts/cd-videos.ps1) | Set the working directory to the user's videos folder | [Help](Docs/cd-videos.md) |
| [check-symlinks.ps1](Scripts/check-symlinks.ps1) | Checks every symlink in a directory tree | [Help](Docs/check-symlinks.md) |
| [check-xml-file.ps1](Scripts/check-xml-file.ps1) | Checks the given XML file for validity | [Help](Docs/check-xml-file.md) |
| [clear-recycle-bin.ps1](Scripts/clear-recycle-bin.ps1) | Removes the content of the recycle bin folder (can not be undo!) | [Help](Docs/clear-recycle-bin.md) |

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