Answer to Question #32702 in Programming & Computer Science for Andrew Loff

Question #32702
I want to make bat (windows) file that will move * files from desktop to x folder and then make shortcuts on the desktop (they must be linked to files in x folder).
So: the problem is: There is no way to make shortcut using bat. Only using third-party applications... Or/and using scripts.
I need the program/script... that will get their adress, link shortcut to every single file (...\x\s.exe, desktop\s.lnk; ...\l.txt, desktop\l.lnk)...
1
Expert's answer
2013-07-16T08:49:13-0400
Create ashortcut on the desktop using vbs:
setobjWSHShell = CreateObject("WScript.Shell")

'command line arguments
'TODO: error checking
sShortcut= objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(0))
sTargetPath= objWSHShell.ExpandEnvironmentStrings(WScript.Arguments.Item(1))

setobjSC = objWSHShell.CreateShortcut(sShortcut)

objSC.TargetPath= sTargetPath

objSC.Save

Use:
cscriptcreateLink.vbs "C:Documents and Settings\%USERNAME%DesktopProgram1
shortcut.lnk" "c:program FilesApp1program1.exe"

cscript createLink.vbs "C:Documents andSettings\%USERNAME%Start MenuProgramsProgram1 shortcut.lnk"
"c:program FilesApp1program1.exe"

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS