{"id":346,"date":"2021-09-03T19:59:44","date_gmt":"2021-09-03T19:59:44","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/windows-xp-batch-file-to-install-msi-and-check-errorlvl-178657-html-2"},"modified":"2021-09-03T19:59:44","modified_gmt":"2021-09-03T19:59:44","slug":"windows-xp-batch-file-to-install-msi-and-check-errorlvl-178657-html-2","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/windows-xp\/batch-file-to-install-msi-and-check-errorlvl\/178657.html","title":{"rendered":"Batch file to install msi and check errorlvl"},"content":{"rendered":"<td>\n<p>Hi Guys,<br \/>I&#8217;m trying to create a batach file that upgrades icaclient but if its being used to return an error and exit the batch file. If not being used it will upgrade the client. Here is my batch file:<\/p>\n<p>@echo on <\/p>\n<p>start \/wait msiexec \/i C:XenAppxenapphosted.msi \/qn \/norestart \/l*v c:XenAppinstall.log<\/p>\n<p>@echo off <\/p>\n<p>echo &#8220;errorlevel = %errorlevel%&#8221; <br \/>if &#8220;%errorlevel%&#8221; == &#8220;0&#8221; goto OK<br \/>if &#8220;%errorlevel%&#8221; == &#8220;1013&#8221; goto err<br \/>if &#8220;%errorlevel%&#8221; == &#8220;1603&#8221; goto err<br \/>if not &#8220;%errorlevel%&#8221; == &#8220;0&#8221; goto err <\/p>\n<p>:OK<br \/>cscript C:XenAppHostedrenameicafolder.vbs<br \/>copy C:XenAppappsrv.ini C:&#8221;Program FilesCitrixICA Client&#8221; \/y<br \/>copy C:XenAppmodule.ini C:&#8221;Program FilesCitrixICA Client&#8221; \/y<br \/>copy C:XenApppn.ini C:&#8221;Program FilesCitrixICA Client&#8221; \/y<br \/>reg.exe import C:XenApppnsson.reg<br \/>GOTO END<\/p>\n<p>:err <\/p>\n<p>rem print message and return errorlevel so package errors <\/p>\n<p>echo &#8220;Error: Msiexec failed with errorlevel = %errorlevel%&#8221; <\/p>\n<p>exit \/b %errorlevel% <\/p>\n<p>:END<\/p>\n<p>But every time I run it it gives errorlvl = 0 and always completes. I can&#8217;t get it to fail even though the install fails. What am I missing, please help.<\/p>\n<\/td>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","meta":{"inline_featured_image":false,"iawp_total_views":60},"question-category":[],"question_tags":[],"class_list":["post-346","question","type-question","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=346"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=346"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=346"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}