.lnk shortcut - create programatically
Posted: 21 Oct 2023 04:52
As far as VBS is marked as obsolete (and will be removed from next windows version), looking for alternative way of shortcut creation from batch file other than VBS script. Found powershell oneliner
but look like this rely on WScript which is de-facto VBS. Does this powershell will work even after VBS engine will be removed?
Code: Select all
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$shortcut = New-Object -ComObject WScript.Shell; $link = $shortcut.CreateShortcut('%shortpath%\short_%s_name%.lnk'); $link.TargetPath = '%target%'; $link.WorkingDirectory = '%workdir%'; $link.Arguments = '%params%'; $link.Description = '%desc%'; $link.IconLocation = '%icon%'; $link.WindowStyle = %windowstyle%; $link.Hotkey = '%hotkey_combination%+%letter%'; [console]::CursorVisible = $false; $link.Save()"