|
Answer» I have a batch file where I call a .exe
Im TRYING to pickup the errorlevel returned from this but the .exe creates a popup window that says the error code with an OK button. After clicking ok the %errorlevel% is returning as 0.
1. Is there a way to suppress the popup? I dont know if there are codes like /Y for it or not. 2. How can I pickup the errorlevel from this .exe? If I cant get the errorlevel then I simply want to suppress the popup and return wether or not it completed successfully regardless of the error code.
ThanksSuppressing the Pop up will likely not get answered here as for it can be used for improper malicious usage, even if your intent is harmless.
What is the EXE that you are running and what does it do?Nothing Malicious here.
The exe is runmac32.exe which is a Cognos executable that swaps a data connection to a powercube for the product.
My intent here is to error trap if the swap is succesful but the command line
"D:\Program Files\cognos\cer4\bin\runmac32.exe" "D:\RM Bat Files\Cube.mac"
Produces a little popup that says "Error Code XX" with an OK button. I need to get passed the OK button and pick up wether or not the command line executed successfully.
Thanksmrobby, post your batch code here. along with a screenshot of the errormessage popup+successful popup.REM Copy model to local directory for cube build copy "\\ixca-fs1\dfs\common\cognos\bi\cubes\RM Cubes\Ixia_Forecast.pyi" "\\ixca-cogdev\RM Cube Model Temp\Forecast.pyi" /Y IF %ERRORLEVEL%==1 THEN GOTO CopyFail
This is the code I want to error check "D:\Program Files\cognos\cer4\bin\runmac32.exe" "D:\RM Bat Files\Build_Forecast_Cube.mac"
REM Delete local copy of the model used to build the cube del "\\ixca-cogdev\RM Cube Model Temp\Ixia_Forecast.pyi"
REM Delete all files in the PRODUCTION cube folder del "\\ixca-fs1\dfs\common\cognos\bi\cubes\RM Cubes\Finance Forecast\ixia_forecast*.mdc"
REM create a timestamp variable set _date=%date:~10,4%%date:~4,2%%date:~7,2% set _timestamp=%_date% set _time=%time:~0,2%%time:~3,2%%time:~6,2% set _yesterday=%date:~10,4%%date:~4,2%%date:~7,2%-1
REM change any space to a zero set _time=%_time: =0%
set _timestamp=%_timestamp%%_time%
REM Copy previously built cube to production folder with time stamp appended to end of the name copy "\\ixca-fs1\dfs\common\cognos\bi\cubes\rm cubes\forecast.mdc" "\\common\cognos\bi\cubes\RM Cubes\Forecast\forecast%_timestamp%.mdc" /Y
REM Run cubeswap utility to update cognos connection to new cube D: cd "\Program Files\Cognos\C8\webapps\utilities\cubeswap" call cubeSwap.bat -dispatchername="http://ixca-cogdev:9300" -datasource="RM_PowerPlay_Opex" -url="http://ixca-cogdev:9300/p2pd/servlet/dispatch" -windowscube="\\ixca-fs1\dfs\common\cognos\bi\cubes\RM Cubes\Forecast\forecast%_timestamp%.mdc" -namespaceid="Default" -username="" -password="" net send ixca-rmeyers "Cognos Forecast Powercube was updated successfully" goto ending
:CopyFail net send ixca-rmeyers "The forecast powercube failed to build due to a copy failure of the model to the temp directory" goto ending
:ending
[attachment DELETED by admin]There is no popup if the command executes successfullyi dont see any runmac32.exe calling here, so my guess is it's inside the cubeswap.bat.
create a new file supress.vbs Code: [Select]appname="build_" wsh.sleep 10000 set a=createobject("wscript.shell") if a.appactivate(appname) then wsh.sleep 100:a.sendkeys "~" else wsh.echo "failed to activate" end if play with the wsh.sleep 10000 command.
then modify the batch file where it contain the runmac32.exe line to : Code: [Select]start "" %comspec% /k "cscript//nologo supress.vbs" runmac32.exe blablba
if the above not working, i was thinking to use WMI to monitor the thread for threadwaitreason=13, but i am stuck to know which one of the thread is msgbox. when the error MSG appears, does the application quit after you click OK?
notes: plz edit your post above and remove the username/password.This part of the code is where I call runmac32.exe. Cubeswap.bat works as intended and is a separate process.
Quote from: mrobby on March 25, 2009, 10:01:00 AM This is the code I want to error check "D:\Program Files\cognos\cer4\bin\runmac32.exe" "D:\RM Bat Files\Build_Forecast_Cube.mac"
ah, somehow i miss that red coded line.
so, have you create supress.vbs? and modify the batch code to : Code: [Select]start "" %comspec% /k "cscript//nologo supress.vbs" "D:\Program Files\cognos\cer4\bin\runmac32.exe" "D:\RM Bat Files\Build_Forecast_Cube.mac"
change /k to /c when everything run smooth.check also the manual or HELP file of runmac32.exe. It may (or may not) provide details on how to put it in "quiet" mode.
|