Vbscript 向所有用户的“开始”菜单添加快捷方式

Vbscript 向所有用户的“开始”菜单添加快捷方式,vbscript,shortcut,desktop-shortcut,Vbscript,Shortcut,Desktop Shortcut,我在“所有用户开始”菜单中创建快捷方式时遇到问题(C:\ProgramData\Microsoft\Windows\start menu) 我找到了解决方案,这是在快捷方式创建脚本之前需要添加的脚本 If WScript.Arguments.Named.Exists("elevated") = False Then 'Launch the script again as administrator CreateObject("Shell.Application").ShellExecut

我在“所有用户开始”菜单中创建快捷方式时遇到问题(
C:\ProgramData\Microsoft\Windows\start menu


我找到了解决方案,这是在快捷方式创建脚本之前需要添加的脚本

If WScript.Arguments.Named.Exists("elevated") = False Then
  'Launch the script again as administrator
  CreateObject("Shell.Application").ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ /elevated", "", "runas", 1
  WScript.Quit
Else
  'Change the working directory from the system32 folder back to the script's folder.
  Set oShell = CreateObject("WScript.Shell")
  oShell.CurrentDirectory = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
End If

那么,到底是什么问题?你有错误吗?不起作用的捷径?什么都没有?如果我理解,需要管理员权限,在下面的目录中创建快捷方式,因为,如果我设置了另一个目录,scritp workingYes。如果您在没有管理员权限的情况下运行脚本,则应该会出现错误…无法保存快捷方式请注意,只有运行脚本的用户是管理员组的成员或知道管理员帐户的凭据时,此操作才会起作用。如果UAC被禁用,当用户不是管理员组的成员时,它将失败。你是对的,它是只工作的管理员组用户,也许你知道如何为所有用户进行设置?如果不嵌入管理员帐户的凭据,这是不可能的。这是不可取的。
If WScript.Arguments.Named.Exists("elevated") = False Then
  'Launch the script again as administrator
  CreateObject("Shell.Application").ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ /elevated", "", "runas", 1
  WScript.Quit
Else
  'Change the working directory from the system32 folder back to the script's folder.
  Set oShell = CreateObject("WScript.Shell")
  oShell.CurrentDirectory = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
End If