我想制作一个可以将文件复制到c:\windows\system32\whatever.vbs
. 问题是我在运行时得到“拒绝访问”。
我试图获得管理员权限,但 UAC 仍然出现。谁能给我一个脚本以管理员身份运行我的 vbs 并在运行时禁用 UAC?
这是代码:
option explicit
dim folder, root, f1, source, destination, regedit, WshNetwork
function CopyFile(source, destination)
dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(source) Then
filesys.CopyFile source, destination
End If
end function
Set WshNetwork = WScript.CreateObject("WScript.Network")
set folder = CreateObject("Scripting.FileSystemObject")
set root = folder.GetFile(Wscript.ScriptFullName)
source = root
destination = "c:\Documents And Settings\" & WshNetwork.UserName &"\Start Menu\Programs\Startup\whatever.vbs"
call CopyFile(source,destination)
destination = "c:\Windows\System32\whatever.vbs" -> in here access is denied
call CopyFile(Source,destination)