|
View previous topic :: View next topic |
Author |
Message |
AlexL
Joined: 18 Jul 2006 Posts: 62 Location: Switzerland
|
Posted: Wed Jul 27, 2011 6:29 am Post subject: Shell Script Test - strange %errorlevel% value |
|
|
[AHM v. 8.86, under Windows 2003 and 7]
I am trying to compare two files (I cannot use the File Compare test because one of the files has to be dynamically created by the test itself).
My script is this: Code: | @echo off
FC c:\aaa.txt c:\bbb.txt > nul
IF %errorlevel% == 0 (echo ScriptRes:OK:%errorlevel%) Else (echo ScriptRes:Bad:%errorlevel%) |
If I execute it outside HostMonitor, it gives correct results. However, if I execute it under HM, for example under the Script Manager, with "Let's try", I get a "Bad" result even if I compare a file with itself:
Code: | [13:38:38] HostMonitor is going to execute "TestErrorlevel" script ...
[13:38:38] Script executed, correct result received:
----------
- Status: Bad
- Reply: -1
---------- |
If instead of a file compare I have a
Code: | dir c:\aaa.txt > nul |
the results are correct. But again, in the command window the script with FC does work correctly.
What could it be?
TIA
Alex |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Jul 27, 2011 7:45 am Post subject: Shell Script Test - strange %errorlevel% value |
|
|
Looks like FC utility does not work when HostMonitor uses Windows "pipes".
Solution: you may add SScript_UseWindowsPipe=0 line into [Misc] section of hostmon.ini file and restart HostMonitor.
Note: in such case some scripts will use more system resources. |
|
Back to top |
|
|
AlexL
Joined: 18 Jul 2006 Posts: 62 Location: Switzerland
|
Posted: Wed Jul 27, 2011 8:35 am Post subject: Re: Shell Script Test - strange %errorlevel% value |
|
|
Yes, this did the trick!
Thanks a lot!
Alex |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Jul 27, 2011 8:56 am Post subject: Shell Script Test - strange %errorlevel% value |
|
|
You are welcome ! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|