问题
In batch or cmd, sfc.exe run with a simple command:
%windir%\system32\SFC.exe /SCANNOW
How to run this command with .vbs script (x86 x64)??
Thanks
回答1:
You can do something like this, just give a try !
Option Explicit
' Run as Admin
If Not WScript.Arguments.Named.Exists("elevate") Then
CreateObject("Shell.Application").ShellExecute WScript.FullName _
, WScript.ScriptFullName & " /elevate", "", "runas", 1
WScript.Quit
End If
Dim ws,MyCommand,Execution
Set ws = createobject("wscript.shell")
MyCommand = "SFC /SCANNOW"
Execution = ws.run(MyCommand,1,False)
来源:https://stackoverflow.com/questions/38509033/how-to-launch-system-file-checker-tool-with-vbs