Discussion:
BLAT bat file works in command prompt but ... wont in when called inside ..
(too old to reply)
moztrader
2006-07-31 15:39:55 UTC
Permalink
I have a program that runs executables and bat files from within it.
The system is win2000.
BLATdemo.bat works when run in dos command promt or explorer window
but wont work when run from inside this program I have that has a
designed function to run exe's and bat's.
QUETION IS --> How can I find out whats happening to stop BAT from
working when the BLATlog is empty ?

--> Below is the code BLATDEMO3.bat
::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
:::::::::::::: Lets set some variables ::::::::::::::
set email= <your email >
set email2= <your "from " email address>
set email3= <another email address >

set server=-server <your email server address here >
set subject=-s "Test currencyfast- update"
set tof=-to %email% -f %email% -i %email2% -priority 1 -b %email%
-debug > c:\blat.log

set msgfile=alert.txt
:: -f = sender
:: -i = from:address
:: :::::::::::::::: Now we run Blat! :::::::::::::::::
blat %msgfile% %tof% %subject% %server%
::::::::::: A quick message to the screen :::::::::::
echo.
echo ErrorLevel returned from Blat == %ERRORLEVEL%
echo.

:: Check each errorlevel from 0 through 14 in that order
set ELmsg=Blat returned this ERRORLEVEL
::::::::::::::: Here is the FOR loop! :::::::::::::::
FOR /L %%i IN (0,1,14) DO if ERRORLEVEL %%i echo %ELmsg% %%i
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;
--
Homepage:
http://www.blat.net
moztrader
2006-07-31 15:36:21 UTC
Permalink
I have a program that runs executables and bat files from within it.
The system is win2000.
BLATdemo.bat works when run in dos command promt or explorer window
but wont work when run from inside this program I have that has a
designed function to run exe's and bat's.
QUETION IS --> How can I find out whats happening to stop BAT from
working when the BLATlog is empty ?

--> Below is the code BLATDEMO3.bat
::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
:::::::::::::: Lets set some variables ::::::::::::::
set email= <your email >
set email2= <your "from " email address>
set email3= <another email address >

set server=-server <your email server address here >
set subject=-s "Test currencyfast- update"
set tof=-to %email% -f %email% -i %email2% -priority 1 -b %email%
-debug > c:\blat.log

set msgfile=alert.txt
:: -f = sender
:: -i = from:address
:: :::::::::::::::: Now we run Blat! :::::::::::::::::
blat %msgfile% %tof% %subject% %server%
::::::::::: A quick message to the screen :::::::::::
echo.
echo ErrorLevel returned from Blat == %ERRORLEVEL%
echo.

:: Check each errorlevel from 0 through 14 in that order
set ELmsg=Blat returned this ERRORLEVEL
::::::::::::::: Here is the FOR loop! :::::::::::::::
FOR /L %%i IN (0,1,14) DO if ERRORLEVEL %%i echo %ELmsg% %%i
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;
--
Homepage:
http://www.blat.net
Chip
2006-08-01 00:56:14 UTC
Permalink
Post by moztrader
I have a program that runs executables and bat files from within it.
The system is win2000.
BLATdemo.bat works when run in dos command promt or explorer window
but wont work when run from inside this program I have that has a
designed function to run exe's and bat's.
QUETION IS --> How can I find out whats happening to stop BAT from
working when the BLATlog is empty ?
--> Below is the code BLATDEMO3.bat
@echo off
set email= <your email >
set email2= <your "from " email address>
set email3= <another email address >
set server=-server <your email server address here >
set subject=-s "Test currencyfast- update"
set tof=-to %email% -f %email% -i %email2% -priority 1 -b %email%
-debug > c:\blat.log
set msgfile=alert.txt
:: -f = sender
:: -i = from:address
blat %msgfile% %tof% %subject% %server%
echo.
echo ErrorLevel returned from Blat == %ERRORLEVEL%
echo.
:: Check each errorlevel from 0 through 14 in that order
set ELmsg=Blat returned this ERRORLEVEL
FOR /L %%i IN (0,1,14) DO if ERRORLEVEL %%i echo %ELmsg% %%i
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;
You may have to replace all environment variables with their exact values in
your .BAT file so it can be called from your program.
--
Chip
--
Homepage:
http://www.blat.net
moztrader
2006-08-01 05:37:24 UTC
Permalink
Sorry Chip I dont understand ..

My prgram has a command EXEC which then calls the batch file .

SO eg . EXEC blatdemo3.bat calls the batch file . Program is simply
CALLING batch and not passing any variables across.

The variables of the program are being passed through a creation of
alert.txt file which is loaded with information. Then the rogram
calls the BLATDEMO.bat and that bat attaches the txt file when it
emails.

thinking laterally - if the file is open could this upset BLAT? Any
other ideas how to suss this problem ?

Thanks moz

::::::::::::::::::::::::::::::::::::::::

Chip says -
Post by Chip
You may have to replace all environment variables with their exact values in
your .BAT file so it can be called from your program.
--
Chip
Post by moztrader
I have a program that runs executables and bat files from within it.
The system is win2000.
BLATdemo.bat works when run in dos command promt or explorer
window
Post by Chip
Post by moztrader
but wont work when run from inside this program I have that has a
designed function to run exe's and bat's.
QUETION IS --> How can I find out whats happening to stop BAT from
working when the BLATlog is empty ?
--> Below is the code BLATDEMO3.bat
@echo off
set email= <your email >
set email2= <your "from " email address>
set email3= <another email address >
set server=-server <your email server address here >
set subject=-s "Test currencyfast- update"
set tof=-to %email% -f %email% -i %email2% -priority 1 -b %email%
-debug > c:\blat.log
set msgfile=alert.txt
:: -f = sender
:: -i = from:address
blat %msgfile% %tof% %subject% %server%
echo.
echo ErrorLevel returned from Blat == %ERRORLEVEL%
echo.
:: Check each errorlevel from 0 through 14 in that order
set ELmsg=Blat returned this ERRORLEVEL
FOR /L %%i IN (0,1,14) DO if ERRORLEVEL %%i echo %ELmsg% %%i
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;
You may have to replace all environment variables with their exact values in
your .BAT file so it can be called from your program.
--
Chip
--
Homepage:
http://www.blat.net
Chip
2006-08-01 17:20:50 UTC
Permalink
Post by moztrader
Sorry Chip I dont understand ..
My prgram has a command EXEC which then calls the batch file .
SO eg . EXEC blatdemo3.bat calls the batch file . Program is simply
CALLING batch and not passing any variables across.
The variables of the program are being passed through a creation of
alert.txt file which is loaded with information. Then the rogram
calls the BLATDEMO.bat and that bat attaches the txt file when it
emails.
thinking laterally - if the file is open could this upset BLAT? Any
other ideas how to suss this problem ?
Thanks moz
If your program is holding open the text file to be sent, then Blat cannot
open the file and will bail.

My comments about environment variables were based on the batch file in the
original message, with its internal defined variables. When you EXEC a
batch file, I do not believe that environment variables can be created,
therefore the batch file parser will itself bail at the first "set" command.
--
Homepage:
http://www.blat.net
moztrader
2006-07-31 15:51:53 UTC
Permalink
I have a program that runs executables and bat files from within it.
The system is win2000.
BLATdemo.bat works when run in dos command promt or explorer window
but wont work when run from inside this program I have that has a
designed function to run exe's and bat's.
QUETION IS --> How can I find out whats happening to stop BAT from
working when the BLATlog is empty ?

--> Below is the code BLATDEMO3.bat
::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
:::::::::::::: Lets set some variables ::::::::::::::
set email= <your email >
set email2= <your "from " email address>
set email3= <another email address >

set server=-server <your email server address here >
set subject=-s "Test currencyfast- update"
set tof=-to %email% -f %email% -i %email2% -priority 1 -b %email%
-debug > c:\blat.log

set msgfile=alert.txt
:: -f = sender
:: -i = from:address
:: :::::::::::::::: Now we run Blat! :::::::::::::::::
blat %msgfile% %tof% %subject% %server%
::::::::::: A quick message to the screen :::::::::::
echo.
echo ErrorLevel returned from Blat == %ERRORLEVEL%
echo.

:: Check each errorlevel from 0 through 14 in that order
set ELmsg=Blat returned this ERRORLEVEL
::::::::::::::: Here is the FOR loop! :::::::::::::::
FOR /L %%i IN (0,1,14) DO if ERRORLEVEL %%i echo %ELmsg% %%i
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;
--
Homepage:
http://www.blat.net
Loading...