标题: [问题求助] VBS往C盘复制文件提示权限不够 [打印本页]
作者: iverking 时间: 2022-12-30 10:04 标题: VBS往C盘复制文件提示权限不够
往C盘路径:C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
复制文件
源码:
Const OverwriteExisting = True
fso.CopyFile pathdesktop &"\JY.url" , "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp", OverwriteExisting
我需要把VBS文件做成自解压的文件 让用户运行,请教怎么能做到提升权限?
作者: Batcher 时间: 2022-12-30 11:19
回复 1# iverking
Const OverwriteExisting = True
FSO.CopyFile FolderDesktop & "\JY.url", "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\", OverwriteExisting
作者: Batcher 时间: 2022-12-30 12:17
回复 1# iverking - If Not WScript.Arguments.Named.Exists("RunAsAdmin") Then
- CreateObject("Shell.Application").ShellExecute WScript.FullName, """" & WScript.ScriptFullName & """ /RunAsAdmin", "", "runas", 1
- WScript.Quit
- End If
-
- Set Shell = CreateObject("WScript.Shell")
- FolderDesktop = Shell.SpecialFolders("Desktop")
- Set FSO = CreateObject("Scripting.FileSystemObject")
- Const OverwriteExisting = True
- FSO.CopyFile FolderDesktop & "\JY.url", "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\", OverwriteExisting
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |