How to launch System File Checker tool with vbs

假如想象 提交于 2020-01-03 07:04:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!