Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbscript I want you to execute a command in cmd

Status
Not open for further replies.

Gouli

Technical User
Oct 25, 2021
1
GR
Hello, I have the following problem VBScript , I want you to execute a command in cmd
Eg "WScript.CreateObject("WScript.Shell").Run "DISM.exe /Online /Cleanup_Image /RestorHealth",1,true"
and it will tell me if it was completed or not, that is, if for some reason it stops at 80% to tell false if completed 100% true, is there any order to check whether or not the integration took place? I thought of doing a function to be a Boolean but nothing happened, please help me

Thanks!!!!!
 
Well, it depends if the program DISM returns an error code (0 = if successful, <> 0 if failed)
If so, then you can do something like this:
Code:
error_code = WScript.CreateObject("WScript.Shell").Run "DISM.exe /Online /Cleanup_Image /RestorHealth",1,true"
if error_code <> 0 Then 
   Wscript.Echo "Error: DISM didn't run 100% !"
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top