13 Replies Latest reply on Jan 4, 2011 1:10 PM by Lionel

    .bat file return code 16386 - failed. But it's working


      Here's the code:


      REM If pnamain.exe is running, kill it


      tasklist.exe | find /I "pnamain.exe">NUL
      sdclient.exe /msg="Line 1 completed ErrorLevel %ERRORLEVEL%"
      if "%ERRORLEVEL%" == "0" taskkill /F /IM pnamain.exe 
      sdclient.exe /msg="Line 2 completed ErrorLevel %ERRORLEVEL%"


      exit 0



      I added the sdclient messages to figure out where I was having problems. I've confirmed that the code is working, and I'm getting a "Line 2 completed ErrorLevel 0" message in the console. pnamain.exe is also getting killed off.


      For whatever reason it is returning 16386 Failed to install package.


      I would have thought the exit 0 line would have caused it to exit successfully not matter what. If pnamain.exe wasn't running at the time the bat file ran, I thought whatever the ERRORLEVEL was would be the status of the scheduled task. Apparently not.


      Can anyone lend some insight into this?