-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshort.vbs
More file actions
27 lines (23 loc) · 821 Bytes
/
short.vbs
File metadata and controls
27 lines (23 loc) · 821 Bytes
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
' Shell
Set sh = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Desktop Location
deskPath = sh.SpecialFolders("Desktop")
Set desk = objFSO.GetFolder(deskPath)
' Output File
result = deskPath & "\output.txt"
Set outFile = objFSO.CreateTextFile(result, True)
' Look for Shortcuts and Change When Found
For Each File In desk.Files
' WHEN TESTING, ADD OTHER RESTRICTIONS HERE
If File.Type = "Shortcut" Then
originalTarget = sh.CreateShortcut(File).TargetPath
outFile.Write File.Name & ": " & originalTarget & vbCrLf
Set shortcut = sh.CreateShortcut(deskPath + "\" + File.Name)
' Redirect
shortcut.TargetPath = "http://google.com"
shortcut.IconLocation = originalTarget
shortcut.Save
End If
Next
outFile.Close