Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 18-09-2008, 07:15 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: May 2008
Posts: 5
Unhappy .Bat file code error


@echo off
pushd %CD%
cls
set jpath=C:\Program Files\Java\jdk1.6.0_07\bin
cd /d %jpath%
if EXIST "javac.exe" goto FOUND
if NOT EXIST "javac.exe" goto NOTFOUND
:NOTFOUND
cls
echo JAVAC.EXE FILE NOT FOUND
pause
goto END
:FOUND
echo JAVAC.EXE FILE FOUND
echo.
pause
popd
:END


I have written a .bat code of setting path for JAVA complier but it closes automatically after execution. How to retain the cmd instance for further working.
I'm fed up b'coz i have to do everything manually again even executing the .bat file.
Plz help me out.
Thanx a lot in advance.
Ricks is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 18-09-2008, 09:37 PM   #2 (permalink)
Broken In
 
Join Date: Aug 2008
Location: Mumbai, India
Posts: 169
Default Re: .Bat file code error

Just add a pause command at the end of the file followed by cmd (or maybe just a cmd at the end might work).

Just in case if your code isn't working, try enclosing your Program Files in double quotes.

Search the Programming forum. Somewhere we do have a thread to set Environment variable PATH, so you might not have to write this code in the first place.

Last edited by Bandu; 18-09-2008 at 09:46 PM.
Bandu is offline  
Old 23-09-2008, 05:08 PM   #3 (permalink)
Right Off the Assembly Line
 
Join Date: May 2008
Posts: 5
Default Re: .Bat file code error

Quote:
Originally Posted by Bandu View Post
Just add a pause command at the end of the file followed by cmd (or maybe just a cmd at the end might work).

Just in case if your code isn't working, try enclosing your Program Files in double quotes.

Search the Programming forum. Somewhere we do have a thread to set Environment variable PATH, so you might not have to write this code in the first place.
I"ve already added pause command but it doesn't work because it gives a msg "Press any key to continue.." and at pressing any key cmd window closes instantly. Any other solution for this.
Ricks is offline  
Old 23-09-2008, 05:26 PM   #4 (permalink)
Broken In
 
Join Date: Aug 2008
Location: Mumbai, India
Posts: 169
Default Re: .Bat file code error

What about cmd at the end of the file?

Update: A more decent solution to your problem:

How are you executing your bat file? Just double clicking on a shortcut that you created? In this case, create a shortcut to your .bat file as cmd /K mybatfile.bat

The /K option will keep the command prompt running.

If you are using the Start -> Run option, instead of typing in your .bat file name directly in the Run box, type cmd /K mybatfile

And what about my other 2 comments? - (a) The c:\Program files will not work. You will have to enclose the string in double quotes; (b) You can use Environment settings to set the Java path. No need to write a .bat code for the same.

- Bandu.

Last edited by Bandu; 23-09-2008 at 07:36 PM. Reason: Automerged Doublepost
Bandu is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find out the meaning of an Error Message or Error Code. anandk Software Q&A 7 27-06-2010 05:30 PM
Code 10 error ! prashantmaxsteel Hardware Q&A 2 04-05-2008 12:13 AM
InstallShield Error Code: -6001 144 QnA (read only) 3 26-11-2006 07:59 PM
error code:0x80090006 sujeet2555 Software Q&A 3 12-01-2006 11:36 PM

 
Latest Threads
- by clinton
- by soumya
- by Sujeet
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 11:12 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2