search and copy a folder using vbscript

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Posts: 6
Last visit: Wed Aug 21, 2013 6:58 am

Re: search and copy a folder using vbscript

Post by totalyscrewedup »

Never mind. Found the solution by running following prior the wshShell:
Dim OSList, OS, UAC
UAC = False
If WScript.Arguments.Count >= 1 Then
If WScript.Arguments.Item(0) = "elevated" Then UAC = True
End If

If Not(UAC) Then
Set OSList = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")
For Each OS In OSList
If InStr(1, OS.Caption, "XP") = 0 Then
CreateObject("Shell.Application").ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ elevated" , "", "runas", 1
End If
End If

User avatar
Alexander Riedel
Posts: 7670
Last visit: Sun May 09, 2021 11:51 am
Answers: 3
Been upvoted: 9 times

Re: search and copy a folder using vbscript

Post by Alexander Riedel »

Just wanted to point out that all the things I showed you are free :-)
Alexander Riedel
SAPIEN Technologies, Inc.