ZTree.com  | ZEN  | About...  

 Index   Back

[Help!] VBS shortcut making with many arguments in a target   [Help!]

By: Ryan       
Date: Nov 28,2018 at 05:17

hi

could you help me fixng my VBS as to deal with many arguments in a shortcut's target?
a batch file for input is below

@ECHO OFF
SET C1=C:\ZTREE
SET C2=%C1%\ZTW.EXE
SET H1=C:\VBS MAKE SHORTCUT 3.VBS
SET P7=C:\PURPLE 1.ICO

SET P1=/Tar:%C2%

SET P21=/Arg:/M
SET P22=/Arg:/Y
SET P23=/Arg:"M:\11 22"
SET P24=/Arg:"AA BB.TXT"

SET P3=/Shortcut:"%#ZTDesktop%\AA BB.TXT"
SET P4=/Startin:"%C1%"
SET P5=/Icon:"%P7%"

"%H1%" %P1% %P21% %P22% %P23% %P24% %P3% %P4% %P5%

----------------------------------

the output i am looking for is

c:\ztree\ztw.exe /M /Y "M:\11 22" "AA BB.TXT"

in a shortcut's target

----------------------------------
my VBS trials


Target = WScript.Arguments.Unnamed(0)
Arguments1 = WScript.Arguments.Unnamed(1)
Arguments2 = WScript.Arguments.Unnamed(2)
Arguments3 = WScript.Arguments.Unnamed(3)
Arguments4 = WScript.Arguments.Unnamed(4)
Shortcut = WScript.Arguments.Unnamed(5)
Startin = Wscript.Arguments.Unnamed(6)
Icon = Wscript.Arguments.Unnamed(7)

Set objShell = WScript.CreateObject("WScript.Shell")
Set lnk = objShell.CreateShortcut(Shortcut & ".lnk")

lnk.TargetPath = Target

lnk.Arguments = """" & Arguments1 & """" & """" & Arguments2 & """" & """" & Arguments3 & """" & """" & Arguments4 & """"
lnk.WorkingDirectory = Startin
lnk.IconLocation = Icon

lnk.Save
'Clean up
Set lnk = Nothing

-------------------------------------------
or

lnk.Arguments = """" & Arguments1 & """"
lnk.Arguments = """" & Arguments2 & """"
lnk.Arguments = """" & Arguments3 & """"
lnk.Arguments = """" & Arguments4 & """"

111 views      
 

Messages in this Thread

 
93,933 Postings in 11,850 Threads, 347 registered users, 10 users online (2 registered, 8 guests)
Index | Admin contact |   Forum Time: Dec 10, 2018 - 1:02 pm EST  |  Hits:26,925,853  (2,321 Today )
RSS Feed