Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with backslash, quotations in changing the target path of desktop shortcut

I would like to substitute the target of a desktop shortcut, and I did it. But the problem is, I could not configure the new path as the way I like it to be. The following is my code:

Set wsc = WScript.CreateObject("WScript.Shell")
Set lnk = wsc.CreateShortcut(wsc.SpecialFolders("desktop") & "\Java basics.lnk")

lnk.targetpath = "C:\Windows\System32\wscript.exe ""\\kk-05\apps\network\logon\kbs_logon_file.vbs"""
lnk.arguments = ""
lnk.save 

The above code can be compiled and run successfully, but the updated target is :

"C:\Windows\System32\wscript.exe \kk-05\apps\network\logon\kbs_logon_file.vbs"

what I want is:

C:\Windows\System32\wscript.exe "\\kk-05\apps\network\logon\kbs_logon_file.vbs"

The double quotes do not work properly, why can't just use double backslash like this //? It seems that no matter how many / I typed, it only shows one after execution.

like image 326
Ryan Wang Avatar asked Oct 05 '22 21:10

Ryan Wang


1 Answers

use

lnk.targetpath = "C:\Windows\System32\wscript.exe " lnk.arguments = """\\kk-05\apps\network\logon\kbs_logon_file.vbs"""

like image 54
Travis G Avatar answered Oct 14 '22 06:10

Travis G