Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://stackoverflow.com/a/30028948/5079799

https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/shortcutJS.bat

Note: The script is built to be called, but I modified it to call itself as it was serving a "single purpose". When calling the script, the script must be named `shortcutJS.bat` but when you use it "singularly" you can rename file as desired.

I won't repost entire script, but here is my "call script"

@echo off
pushd %~dp0
cls

:: linkfile = Where Link Is Created
:: target = File from which to generate shortcut
:: linkarguments can be omitted, but if I liked to leave, but you MUST pass ""
call shortcutJS.bat -linkfile "%UserProfile%\Downloads\test.lnk" -target "%UserProfile%\Downloads\shortcutJS.bat" -linkarguments ""
pause

Here is my modified "createshortcut.cmd" to have it "all in one" solution:

@if (@X)==(@Y) @end /* JScript comment
@echo off
pushd %~dp0
cls

Set linkfile="%UserProfile%\Downloads\test.lnk"
Set target="%UserProfile%\Downloads\createshortcut.cmd"
Set linkarguments=""

cscript //E:JScript //nologo "%~f0" "%~nx0" -linkfile %linkfile% -target %target% -linkarguments %linkarguments%
pause

exit /b %errorlevel%
  • No labels