problem running bat files (windows opening)

Benouche
Benouche used Ask the Experts™
on
Hello,

I had some bat files running (on Windows 2000).
I shifted to XP.

With my new DOS, when I launch the following command:

exit| sqlplus ben/ben@DB blabla.sql >> log.txt

I have the following differences/problems :
1- A new window is opened in which the task is achieved
2- to get out of the new window, I have to finish my script by a 'exit' to get back to the DOS
3- As a consequence, he redirection does not work (the file is opened without inserting any info)

How can I control the windows and get the information in my logfiles ???

Thanks in advance,
Benouche

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:

Benouche,

The problem may be that the Pipe redirection command
typically requires that a TEMP environment variable be set...
But the Exit command may not redirect in that manner under XP...

Otherwise try eliminating the Pipe and if possible
rewrite the batch file to close the window like:


::
@echo off
sqlplus ben/ben@DB blabla.sql >> log.txt
cls
exit


Also examine the batch file's PIF properties if available
by right-clicking on the batch file's name to display the PIF dialog...
That may allow you to specify "close on exit" and manipulate other properties...

Please post back if this doesn't help
and include whatever other details you can provide
and perhaps a copy of the entire batch file if there's more to it...
 

Author

Commented:
Dear rin1010,

thanks for the answer !

It didn't made it ... maybe I'm doing something wrong ..

In fact, I've one bat which launch othe bat this way :

set DW="c:\Benoit_SQL\Datawarehouse"
:: EXTRACTION DES DONNEES
:: on charge les données de l'avant-veille (Pre-CJP)
%DW%\launcher_PreCJP.bat 2
%DW%\launcher_PostCJP.bat 20
%DW%\launcher_Modh.bat 7

I've tried also to launch the bat using 'call' and 'start'.


Then let's go to launcher_Post_CJP for example :
set DW="c:\Benoit_SQL\Datawarehouse"
:: TRANSFORMATION DES DONNEES ET CHARGEMENT DES TABLES DU DWHouse
sqlplus benoit/benoit@DWHouse @%DW%/SQL/Select/Select_Transits_Vs_PostCJP.sql >>Log\Select_Vs_PostCJP.log
sqlplus benoit/benoit@DWHouse @%DW%/SQL/Select/Select_Recettes_PostCJP.sql >>Log\Select_Recettes_PostCJP.log
cls
exit

Previously, I had exit|sqlplus ... and it works perfect. As I putted exit| away foolowing your advice, I have putted a exit at the end of my sqp files ...

I still don't have the infos in my log files which is my main problem.

Any idea ???
Thanks,
Benouche

Commented:

Hi Benouche...

I see nothing wrong with your syntax if the paths are all correct.
The double greater-than symbols are appropriate to append output
to the specified file, and you mentioned that the file is being created...

Does the stdout which you're trying to log display on screen
and/or does the redirection to the file work as you want
when manually running the separate commands?

It appears that you're using or passing replaceable parameters
when calling the launcher* batch files...  i.e.,  2, 20, 7 ...
There are no references to the %1 parameter
in the example batch file you posted.
Is that relevant to the script?

If you haven't debugged your entire script(s) under XP
then you might want to step through the individual commands
to try and determine where it fails and examine why stdout isn't logging.

Please post back with your results and any further details
and include whether you changed file systems between
your 2K and XP when your scripts previously worked.

btw... Have you looked at whether the sqlplus 'spool' function is available?
 

Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Author

Commented:
Hi rin1010,

- The file is created and remain empty !

- you're right stdout is displayed on screen, and I still have the same problem when I run manually a command.

- In the extract I've putted in the message, I have no %1 parameters, but they are present in the script !

- I didn't use any debugger .. my scripts are quite simple.

- What do you mean by file system changes ? In fact I made a change of computer, of OS (2000->XP) and Oracle version, and that will also change in the future when I'll put the routines on the server !

- Finally I inserted a spool command yesterday and I'm still not very happy with this ... better than nothin'

Commented:
Hi!

Verify, if possible, what SQLPlus is registered in your REDGISTRI. May be your first SQLPlus is line_mode Plus?

Regards,
pm
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- PAQ'd and points refunded
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
pbarrette

Commented:
Benouche,
No comment has been added lately (47 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: PAQ/No Refund

Please leave any comments here within 7 days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

cempasha
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post a request in Community support (with a link to this page) to refund your points. http://www.experts-exchange.com/Community_Support/
Hi Cempasha,

I'm a lazy bum. Thanks for running through the cleanup. I lost some steam somewhere in the backlog.

pb

Commented:
:) you did all the work I'm just going over them and posting the links
Commented:
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial