にファイルをコピーできるプログラムを作りたいです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)