Hack Forums
[Shell] Create a shortcut with admin rights for the current vbscript or any other application - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] Create a shortcut with admin rights for the current vbscript or any other application (/showthread.php?tid=6210036)



Create a shortcut with admin rights for the current vbscript or any other application - Hackoo - Jun 19, 2022

Hi 😋
I made a subroutine in order to create a shortcut for the current vbscript or any other application with arguments using an array that can be called as follow :
  • Example 1 : Create a shortcut to the current vbscript on the Desktop
Code
Create_Shortcut Array("Desktop","ShortcutName",WScript.ScriptFullName)

OR
  • Example 2 : Create a shortcut to the current vbscript on the User Startup Folder
Code
Create_Shortcut Array("Startup","ShortcutName",WScript.ScriptFullName)

OR
  • Example 3 : Create a shortcut for Network Diagnostics with arguments to fix connections problems on Desktop

Code
'Create_Shortcut Array(_
'   "Desktop",_ '<=== "Desktop" folder and you can change it to "Startup" folder if you want
'   "NetworkDiagnostics",_  '<=== ShortcutName
'   "%SystemRoot%\system32\msdt.exe",_  '<=== Executable Target Path
'   "-skip TRUE -path %Windir%\diagnostics\system\networking -ep NetworkDiagnosticsPNI",_ ' <==== Argument to pass for the executable
'   "%SystemRoot%\system32\msdt.exe,0",_  ' <=== Icon Location
'   "Network Diagnostics to fix connections problems",_ ' <=== Description of our Shortcut
'   "CTRL+ALT+D"_ ' <=== Set a HotKey
')

Run_As_Admin_Create_Shortcut.vbs
Run_As_Admin_Create_Shortcut.vbs (Click to View)