-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakeShortcut.vbs
49 lines (35 loc) · 1.53 KB
/
MakeShortcut.vbs
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
38
39
40
41
42
43
44
45
46
47
48
49
'Option Explicit
Dim strLink
Dim strTargetPath
Dim strScriptFolder
Dim strTarget
Dim strIcon
Dim strJarLocation
' Define variables (modify paths as needed)
'These two lines will create a string containing the folder that the script is in
'without including the file name of the script itself
Set fso = CreateObject("Scripting.FileSystemObject")
strScriptFolder = fso.GetParentFolderName(WScript.ScriptFullName)
'The icon is assumed to be in the same path as the script
strLink = "\Star Citizen Trade Companion.lnk" ' Shortcut name
strTargetPath = "\bin\jre\bin\javaw.exe" ' Target relative path
strTarget = strScriptFolder & strTargetPath ' Combine paths
strIcon = strScriptFolder & "\sc-trade-companion.ico" ' Icon path (assuming in same folder)
strJarLocation = strScriptFolder & "\bin\sc-trade-companion.jar"
' Create WScript.Shell object
Set WShell = CreateObject("WScript.Shell")
' Create the shortcut object in the script folder
' **Use CreateObject with single argument (corrected concatenation)**
Set shortcut = WShell.CreateShortcut(strScriptFolder & "\" & strLink)
' Set shortcut properties
shortcut.TargetPath = strTarget
shortcut.Arguments = "-Xmx512m -jar " & Chr(34) & strJarLocation & Chr(34) ' Set command-line arguments
shortcut.WorkingDirectory = strScriptFolder
shortcut.WindowStyle = 1 ' Minimized (optional)
shortcut.Description = "Star Citizen Trade Companion"
' Set icon location
shortcut.IconLocation = strIcon
' Save the shortcut
shortcut.Save
' Display success message
'WScript.Echo "Shortcut created successfully!"