0

I am a Java programmer, and I do not know anything about VBScript. I needed a way to modify the target path of a certain shortcut, and I according to my research, only VBScript can help me. I tried it, but there were many errors.


I tried to resolve them by a butt ton of googling, but I think there is some other problem. Here is the code:

Set sh = CreateObject("WScript.Shell")
Set shortcut = sh.CreateShortcut("C:\Users\pedne\Desktop\Zoom.lnk")
shortcut.TargetPath = "C:\Users\pedne\AppData\Roaming\Zoom\bin\Zoom.exe ""--url=zoommtg\://zoom.us/join?action=join&confno=955 1234 1234&pwd=12345"""
shortcut.Save

I do not know whether I need any prerequisites or external libraries for writing VBScript code, and I wrote it on notepad.I would also like to know whether there is any 100% Java or any other workaround to this. (Totally up to you) Please excuse me if I do not understand anything about your answers as I copied the code from Change a shortcut's target from command prompt


The last error I got was at Line 3 char 1, Invalid procedure or call

Ojas Pednekar
  • 39
  • 1
  • 2
  • 8
  • As for Java, I found [this library](https://github.com/DmitriiShamrikov/mslinks) in the answers of [this post](https://stackoverflow.com/q/13145942/8967612). I haven't tried any of the suggestions there myself though. – 41686d6564 stands w. Palestine Apr 17 '21 at 17:23
  • Does this answer your question? [Changing Target in Shortcut with VBScript](https://stackoverflow.com/questions/13129117/changing-target-in-shortcut-with-vbscript) – user692942 Apr 18 '21 at 15:32
  • nah, I just wanted to correct the errors over here. It is done. Thank you for your concern... – Ojas Pednekar Apr 23 '21 at 08:44

1 Answers1

2

Do not append the arguments to the target path. Use the Arguments property instead:

shortcut.TargetPath = "C:\Users\pedne\AppData\Roaming\Zoom\bin\Zoom.exe"
shortcut.Arguments = "--url=zoommtg\://zoom.us/join?action=join&confno=955 1234 1234&pwd=12345"
shortcut.Save