millklion.blogg.se

Craigslist desktop shortcut
Craigslist desktop shortcut






craigslist desktop shortcut

Here's a similar solution using powershell (I know, you can probably re-write your whole batch file in PS, but if you just want to Get It Done™.) set TARGET='D:\Temp'

craigslist desktop shortcut

SET Esc_LinkTarget=%%SYSTEMROOT%%\notepad.exeĮcho Set oWS = WScript.CreateObject^("WScript.Shell"^)Įcho sLinkFile = oWS.ExpandEnvironmentStrings^("!Esc_LinkDest!"^)Įcho Set oLink = oWS.CreateShortcut^(sLinkFile^)Įcho oLink.TargetPath = oWS.ExpandEnvironmentStrings^("!Esc_LinkTarget!"^) SET Esc_LinkDest=%%HOMEDRIVE%%%%HOMEPATH%%\Desktop\!LinkName!.lnk Here's a more complete snippet from an anonymous contributor (updated with a minor fix): off

craigslist desktop shortcut

Running the above script results in a new shortcut on my desktop: For example, like so: offĮcho Set oWS = WScript.CreateObject("WScript.Shell") > CreateShortcut.vbsĮcho sLinkFile = "%HOMEDRIVE%%HOMEPATH%\Desktop\Hello.lnk" > CreateShortcut.vbsĮcho Set oLink = oWS.CreateShortcut(sLinkFile) > CreateShortcut.vbsĮcho oLink.TargetPath = "C:\Windows\notepad.exe" > CreateShortcut.vbs So, if you really must do it, then you could make your batch file write the VB script to disk, invoke it and then remove it again. ' oLink.WorkingDirectory = "C:\Program Files\MyApp" ' oLink.IconLocation = "C:\Program Files\MyApp\MyProgram.EXE, 2" OLink.TargetPath = "C:\Program Files\MyApp\MyProgram.EXE" Set oLink = oWS.CreateShortcut(sLinkFile) Optional sections in the VBscript below are commented out: Set oWS = WScript.CreateObject("WScript.Shell") Seems like there is some shortcut.exe in some resource kit which I don't have.Īs many other sites mention, there is no built-in way to do it from a batch file. There is some very useful information on this site:








Craigslist desktop shortcut