mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-12 14:07:20 +02:00
Added create-symlink.ps1
This commit is contained in:
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
|
||||
}
|
Reference in New Issue
Block a user