76 361
Assignments Done
Successfully Done
In May 2019

Answer to Question #32702 in Other 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)...
Expert's answer
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


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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions