mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Updated the scripts
This commit is contained in:
parent
92f1d04de3
commit
af03a1a13c
@ -12,22 +12,22 @@
|
||||
License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Shortcut = "", [string]$Target = "", [string]$Description)
|
||||
param([string]$shortcut = "", [string]$target = "", [string]$description)
|
||||
|
||||
try {
|
||||
if ($Shortcut -eq "" ) { $Shortcut = read-host "Enter filename of shortcut" }
|
||||
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
|
||||
if ($Description -eq "" ) { $Description = read-host "Enter description" }
|
||||
if ($shortcut -eq "" ) { $shortcut = read-host "Enter new shortcut filename" }
|
||||
if ($target -eq "" ) { $target = read-host "Enter path to target" }
|
||||
if ($description -eq "" ) { $description = read-host "Enter description" }
|
||||
|
||||
$sh = new-object -ComObject WScript.Shell
|
||||
$shortcut = $sh.CreateShortcut("$Shortcut.lnk")
|
||||
$shortcut.TargetPath = "$Target"
|
||||
$shortcut.WindowStyle = "1"
|
||||
$shortcut.IconLocation = "C:\Windows\System32\SHELL32.dll, 3"
|
||||
$shortcut.Description = "$Description"
|
||||
$shortcut.save()
|
||||
$sc = $sh.CreateShortcut("$shortcut.lnk")
|
||||
$sc.TargetPath = "$target"
|
||||
$sc.WindowStyle = "1"
|
||||
$sc.IconLocation = "C:\Windows\System32\SHELL32.dll, 3"
|
||||
$sc.Description = "$description"
|
||||
$sc.save()
|
||||
|
||||
write-host -foregroundColor green "✔️ shortcut $Shortcut created."
|
||||
"✔️ created shortcut $shortcut ⭢ $target"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -12,15 +12,15 @@
|
||||
License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Symlink = "", $[string]Target = "")
|
||||
param([string]$symlink = "", $[string]target = "")
|
||||
|
||||
try {
|
||||
if ($Symlink -eq "" ) { $Symlink = read-host "Enter filename of symlink" }
|
||||
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
|
||||
if ($symlink -eq "" ) { $symlink = read-host "Enter new symlink filename" }
|
||||
if ($target -eq "" ) { $target = read-host "Enter path to target" }
|
||||
|
||||
new-item -path "$Symlink" -itemType SymbolicLink -Value "$Target"
|
||||
new-item -path "$symlink" -itemType SymbolicLink -Value "$target"
|
||||
|
||||
"✔️ created symlink $Symlink (pointing to $Target)"
|
||||
"✔️ created symlink $symlink ⭢ $target"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -2,7 +2,7 @@
|
||||
.SYNOPSIS
|
||||
create-tag.ps1 [<new-tag-name>] [<repo-dir>]
|
||||
.DESCRIPTION
|
||||
Creates a new tag in the current/given Git repository
|
||||
Creates a new tag in a Git repository
|
||||
.EXAMPLE
|
||||
PS> .\create-tag.ps1 v1.7
|
||||
.LINK
|
||||
@ -17,6 +17,8 @@ param([string]$NewTagName = "", [string]$RepoDir = "$PWD")
|
||||
try {
|
||||
if ($NewTagName -eq "") { $NewTagName = read-host "Enter new tag name" }
|
||||
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
@ -36,7 +38,8 @@ try {
|
||||
& git push origin "$NewTagName"
|
||||
if ($lastExitCode -ne "0") { throw "Error: 'git push origin $NewTagName' failed!" }
|
||||
|
||||
"🔖 tag $NewTagName has been created"
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ created new tag '$NewTagName' in $Elapsed sec"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user