Please I would like to know how I can copy files in windows using windows variable path with vbscript under elevated privillege. I have tried the codes below but it's not working.
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