Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to make a vbscript that will create a shortcut of another vbscript and put the shortcut in the startup directory.

(我正在尝试制作一个vbscript,它将创建另一个vbscript的快捷方式并将该快捷方式放在启动目录中。)

Dim myVar
Dim WshShell
Set WshShell = Wscript.CreateObject("WScript.Shell")
myVar = WshShell.ExpandEnvironmentStrings("%APPDATA%")

Set objShell = CreateObject("Wscript.Shell")
objShell.CurrentDirectory = (myVar & "MicrosoftWindowsStart MenuProgramsStart-up")

Set sh = CreateObject("WScript.Shell")
Set shortcut = sh.CreateShortcut("rickroll.lnk")
shortcut.TargetPath = "..launcher.vbs"
shortcut.Save

But for some reason it cannot use %appdata%.

(但是由于某种原因,它不能使用%appdata%。)

How do I get it to work with %appdata%?

(如何使它与%appdata%一起使用?)

  ask by Liam Kelly translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
776 views
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...