使用子文件夹创建开始菜单图标

时间:2014-07-06 23:53:58

标签: vbscript subdirectory startmenu

我正在尝试创建一个VB脚本来为Microsoft Kodu创建图标,因为在使用系统帐户时通过Microsoft SCCM部署时不会创建图标(这真的很痛苦。)

我从一些朋友那里得到了一些关于将文件夹创建任务分成两个步骤的建议,一个用于" Microsoft Research"另一个是#34; Kodu Game Lab"但是我被困在第19行,第2个字符 - 我猜我正在犯一个类似n00b的错误,因为我对脚本来说还不够新!

有什么建议吗? 这是我的剧本:

Dim shell, Objfso, allStartMenu, myShortcut, allProgramMenuMR, allProgramMenuKodu
Set Objfso = CreateObject("Scripting.FileSystemObject")
Set shell = WScript.CreateObject("WScript.Shell")

'Tells script how to get to All Users Start Menu
allProgramMenu = shell.SpecialFolders("AllUsersPrograms")

'Tells script to check if Microsoft Research start menu folder exists and creates it if necessary.
allProgramMenuMR = allProgramMenu + "\\Microsoft Research"

if not Objfso.FolderExists (allProgramMenuMR) Then
    Objfso.CreateFolder (allProgramMenuMR)
End If

'Tells script to check if Kodu Game Lab start menu folder exists and creates it if necessary.
allProgramMenuKodu = allProgramMenu + allProgramMenuMR + "\\Kodu Game Lab"

if not Objfso.FolderExists (allProgramMenuKodu) Then
    Objfso.CreateFolder (allProgramMenuKodu)
End If

' Create Kodu Game Lab shortcut

Set myShortcut = shell.CreateShortcut(allProgramMenuKodu + allProgramMenuMR + "\\Kodu Game Lab.lnk")

myShortcut.TargetPath = "C:\Program Files (x86)\Microsoft Research\Kodu Game Lab\Boku.exe"
myShortcut.Arguments = "/NoUpdate /NoInstrumentation"
myShortcut.WorkingDirectory = ""
myShortcut.WindowStyle = 4
myShortcut.Description = "Launch Kodu Game Lab."
myShortcut.Save()


' Create Configure Kodu Game Lab shortcut

Set myShortcut = shell.CreateShortcut(allProgramMenuKodu + allProgramMenuMR + "\\Configure Kodu Game Lab.lnk")

myShortcut.TargetPath = "C:\Program Files (x86)\Microsoft Research\Kodu Game Lab\BokuPreBoot.exe" 
myShortcut.WorkingDirectory = "C:\Program Files (x86)\RSA Security\RSA Authentication Manager\prog\"
myShortcut.WindowStyle = 4
myShortcut.Description = "Launch Kodu Game Lab Configuration Utility"
myShortcut.Save()

1 个答案:

答案 0 :(得分:0)

问题在于该行的括号。您有两种选择:

  1. 在该行上删除(),因为您没有在该行上设置变量。 ()不是必需的或

  2. 将行更改为阅读newFolder = Objfso.CreateFolder(AllProgramMenuKodu)