【发布时间】:2020-02-09 15:48:12
【问题描述】:
我想知道如何在提升的特权下使用带有 vbscript 的 windows 变量路径在 windows 中复制文件。我已经尝试了下面的代码,但它不起作用。
dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("%AppData%\file.exe") Then
filesys.CopyFile "%AppData%\file.exe", "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\"
End If
Dim objFso, strSourcePath, strDestPath
strSourcePath = "%AppData%\file.exe"
strDestPath = "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\"
Set objFso = CreateObject("Scripting.FileSystemObject")
If objFso.FileExists(strSourcePath) then
objFso.CopyFile strSourcePath, strDestPath, True
End If
Set objFso = Nothing
【问题讨论】:
-
你怎么知道它不起作用?
-
我检查了文件目录,我发现在运行vbs脚本后文件没有显示,所以我使用ultrasearch软件按日期搜索文件,我没有找到它。