Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
849 views
in Technique[技术] by (71.8m points)

vbscript - 尝试创建快捷方式时,vbscript错误(Error in vbscript while trying to create shortcut)

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

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

Please log in or register to reply this article.

OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...