Added create-symlink.ps1

This commit is contained in:
Markus Fleschutz 2021-02-17 08:24:03 +01:00
parent ea19ee6769
commit f0fe3a50b0
3 changed files with 28 additions and 0 deletions

View File

@ -18,6 +18,7 @@ close-thunderbird.ps1, closes Mozilla Thunderbird gracefully
close-vlc.ps1, closes the VLC media player gracefully
close-windows-terminal.ps1, closes Windows Terminal gracefully
configure-git.ps1, sets up the Git user configuration
create-symlink.ps1, creates a symbolic link
csv-to-text.ps1, converts the given CSV file into a text list
daily-tasks.sh, execute PowerShell scripts automatically as daily tasks (Linux only)
decrypt-file.ps1, decrypts the given file

1 Script Description
18 close-vlc.ps1 closes the VLC media player gracefully
19 close-windows-terminal.ps1 closes Windows Terminal gracefully
20 configure-git.ps1 sets up the Git user configuration
21 create-symlink.ps1 creates a symbolic link
22 csv-to-text.ps1 converts the given CSV file into a text list
23 daily-tasks.sh execute PowerShell scripts automatically as daily tasks (Linux only)
24 decrypt-file.ps1 decrypts the given file

View File

@ -24,6 +24,7 @@ Table of Contents
* [close-vlc.ps1](Scripts/close-vlc.ps1) - closes the VLC media player gracefully
* [close-windows-terminal.ps1](Scripts/close-windows-terminal.ps1) - closes Windows Terminal gracefully
* [configure-git.ps1](Scripts/configure-git.ps1) - sets up the Git user configuration
* [create-symlink.ps1](Scripts/create-symlink.ps1) - creates a symbolic link
* [csv-to-text.ps1](Scripts/csv-to-text.ps1) - converts the given CSV file into a text list
* [daily-tasks.sh](Scripts/daily-tasks.sh) - execute PowerShell scripts automatically as daily tasks (Linux only)
* [decrypt-file.ps1](Scripts/decrypt-file.ps1) - encrypts the given file

26
Scripts/create-symlink.ps1 Executable file
View File

@ -0,0 +1,26 @@
#!/bin/powershell
<#
.SYNTAX ./create-symlink.ps1 [<symlink>] [<target>]
.DESCRIPTION creates a symbolic link
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($Symlink = "", $Target = "")
try {
if ($Symlink -eq "" ) {
$Symlink = read-host "Enter filename of symlink"
}
if ($Target -eq "" ) {
$Target = read-host "Enter path to target"
}
new-item -path "$Symlink" -itemType SymbolicLink -Value "$Target"
write-host -foregroundColor green "Done."
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}