mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-25 05:26:47 +01:00
Added create-symlink.ps1
This commit is contained in:
parent
ea19ee6769
commit
f0fe3a50b0
@ -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
|
||||
|
|
@ -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
26
Scripts/create-symlink.ps1
Executable 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user