dcthaju
dcthaju

Reputation: 49

how to prevent moving for the next command if current command is not success

I am working on a script for adding printer my command is in below

 @echo off
    echo.
    rundll32 printui.dll,PrintUIEntry /in /n\\10.50.100.104\printer1
echo Printer Installation Completed... 

need to display a error if mapping is not success

echo Installation not success or interrupted

Please advice

Upvotes: 0

Views: 31

Answers (1)

user6811411
user6811411

Reputation:

Use conditional execution on fail || or success &&

@echo off
echo.
rundll32 printui.dll,PrintUIEntry /in /n\\10.50.100.104\printer1 && (
   echo Printer Installation Completed...
) || (
   echo Installation not successfull or interrupted
)

Upvotes: 1

Related Questions