Creating shortcuts from batch

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Guest
Hey guys!
I want to write a batch script that creates a shortcut to every file in a certain folder.
Let's assume the target path is T:\
(all files and folders on the root drive)
and the shortcuts shall be saved in J:\Shortcuts\.
Please help me accomplish this.
Thanks! :)
 
Thanks a lot for the reply, but these are rather external programs. In the meanwhile, I tried this:
set SCRIPT="%RANDOM%.vbs"
for /f %%f in ('dir /b') do echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT% && echo sLinkFile = "%%f.lnk" >> %SCRIPT% && echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT% && for /f %%f in ('dir /b') do echo oLink.TargetPath = "%~dp0%%f" >> %SCRIPT% && echo oLink.Save >> %SCRIPT% && cscript /nologo %SCRIPT%

That should (note: SHOULD) create a shortcut to every item in the current folder. However, it only works for folders, and it doesn't adopt the correct icon.
What did I do wrong?