-
Notifications
You must be signed in to change notification settings - Fork 0
/
shortCuts.ps1
37 lines (30 loc) · 940 Bytes
/
shortCuts.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Template script for creating shortcuts
# Author: Sean Richards
# Date: 12/20/2023
# Ability to remove the shortcut
param ($uninstall = $false)
# Required configuration
$ico = ""
$uri = ""
$name = "nameMe.lnk"
# Constant Variables
$icoPath = "C:\Users\Public\Pictures\"
$lnkPath = "C:\Users\Public\Desktop\"
$program = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
if ($uninstall -eq $false) {
# Move ICO file
Copy-Item $ico -Destination $icoPath
# Create shortcut
$WScriptObj = New-Object -ComObject ("WScript.Shell")
$ShortcutPath = "$lnkPath$name"
$shortcut = $WscriptObj.CreateShortcut($ShortcutPath)
$shortcut.TargetPath = $program
$shortcut.Arguments = $uri
$ShortCut.IconLocation = "$icoPath$ico, 0"
$shortcut.Save()
}
else {
Remove-Item -Path $lnkPath$name -Force
Remove-Item -Path $icoPath$ico -Force
}
# Don't forget to place your ico file in the folder