|
| 1 | +'Option Explicit |
| 2 | + |
| 3 | +Dim strLink |
| 4 | +Dim strTargetPath |
| 5 | +Dim strScriptFolder |
| 6 | +Dim strTarget |
| 7 | +Dim strIcon |
| 8 | +Dim strJarLocation |
| 9 | + |
| 10 | +' Define variables (modify paths as needed) |
| 11 | + |
| 12 | +'These two lines will create a string containing the folder that the script is in |
| 13 | +'without including the file name of the script itself |
| 14 | +Set fso = CreateObject("Scripting.FileSystemObject") |
| 15 | +strScriptFolder = fso.GetParentFolderName(WScript.ScriptFullName) |
| 16 | + |
| 17 | + |
| 18 | +'The icon is assumed to be in the same path as the script |
| 19 | +strLink = "\Star Citizen Trade Companion.lnk" ' Shortcut name |
| 20 | +strTargetPath = "\bin\jre\bin\javaw.exe" ' Target relative path |
| 21 | +strTarget = strScriptFolder & strTargetPath ' Combine paths |
| 22 | +strIcon = strScriptFolder & "\sc-trade-companion.ico" ' Icon path (assuming in same folder) |
| 23 | +strJarLocation = strScriptFolder & "\bin\sc-trade-companion.jar" |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +' Create WScript.Shell object |
| 29 | +Set WShell = CreateObject("WScript.Shell") |
| 30 | + |
| 31 | +' Create the shortcut object in the script folder |
| 32 | +' **Use CreateObject with single argument (corrected concatenation)** |
| 33 | +Set shortcut = WShell.CreateShortcut(strScriptFolder & "\" & strLink) |
| 34 | + |
| 35 | +' Set shortcut properties |
| 36 | +shortcut.TargetPath = strTarget |
| 37 | +shortcut.Arguments = "-Xmx512m -jar " & Chr(34) & strJarLocation & Chr(34) ' Set command-line arguments |
| 38 | +shortcut.WorkingDirectory = strScriptFolder |
| 39 | +shortcut.WindowStyle = 1 ' Minimized (optional) |
| 40 | +shortcut.Description = "Star Citizen Trade Companion" |
| 41 | + |
| 42 | +' Set icon location |
| 43 | +shortcut.IconLocation = strIcon |
| 44 | + |
| 45 | +' Save the shortcut |
| 46 | +shortcut.Save |
| 47 | + |
| 48 | +' Display success message |
| 49 | +'WScript.Echo "Shortcut created successfully!" |
0 commit comments