473,854 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About batch file!!!

539 Contributor
Can a batch file executes the .COM file?
Can i invoke it with java?

I really have no experience on batch file....

can you give me some patterns or hint code?
or if you can't, just the best URL you have known?!!!

Any reply will be greatly appreciated,
Sukatoa
Feb 29 '08 #1
29 2558
AmberJain
884 Recognized Expert Contributor
Can a batch file executes the .COM file?
Can i invoke it with java?

I really have no experience on batch file....

can you give me some patterns or hint code?
or if you can't, just the best URL you have known?!!!

Any reply will be greatly appreciated,
Sukatoa
_______________ _______________ _______________ _______________ _____
Yes, a batch file can execute a .com file.

A simple batch file executing command.com is give below------>
*************** *************** *************** *************** *************** *************** *
cd\
cd windows
cd system32
command.com
exit

*************** *************** *************** *************** *************** *************** *
I don't know JAVA and therefore am unaware whether a batch file can be executed from it. Better option is posting JAVA portion (part of this problem relating to java) of this problem into JAVA forum. You will get better answer there.

If you don't know to create a batch file, do tell me. I will then post a reply with a detailed description of creating a batch file.
If you face any other problems, do tell me.
_______________ _______________ _______________ _______________ _____
HOPE THIS HELPS.........
Mar 1 '08 #2
sukatoa
539 Contributor
_______________ _______________ _______________ _______________ _____
Yes, a batch file can execute a .com file.

A simple batch file executing command.com is give below------>
*************** *************** *************** *************** *************** *************** *
cd\
cd windows
cd system32
command.com
exit

*************** *************** *************** *************** *************** *************** *
I don't know JAVA and therefore am unaware whether a batch file can be executed from it. Better option is posting JAVA portion (part of this problem relating to java) of this problem into JAVA forum. You will get better answer there.

If you don't know to create a batch file, do tell me. I will then post a reply with a detailed description of creating a batch file.
If you face any other problems, do tell me.
_______________ _______________ _______________ _______________ _____
HOPE THIS HELPS.........
I already post that problem in the java forum and no one replies me there. Maybe they hate me... here is the link...

I know how to invoke Command prompt in java

Here is what i've been stucked...

I have a subject Assembly language, i feel hustle when i compile my a86 code in the CMD...

So i've made an editor made in java that would compile and run the generated .COM file...

If my a86 code named TEMP.ASM will be compiled, the A86 compiler will then generate the TEMP.COM (the program like .exe)...

at compiling, no problem
at executing TEMP.COM file, here is the problem...

I am satisfied when invoking .COM file from java...
but, the flow of the program change...

as the TEMP.COM invoked, executed, i expect that the program would wait until any character is pressed and then print that character and wait again for any character then terminated...

when i invoke that TEMP.COM in java, it waits for a character, but when i entered a character, it doesn't print...

Here is the java code for invoking .COM file,

Expand|Select|Wrap|Line Numbers
  1. Runtime.getRuntime.exec("cmd /C start TEMP.COM");
But when i double clicked the .COM file, im satisfied with the flow...

I i hope that in this forum will then help me with this kind of problem,

And thank you bro...



Here is my kind question for you,
Base on your code posted above,

It is like you are using CMD and looking for that file by googling the folders, am i right?

When i double clicked that batch file, is it automatically execute my TEMP.COM file?

If yes, then this is the answer ive been waiting for...
Mar 2 '08 #3
AmberJain
884 Recognized Expert Contributor
Here is my kind question for you,
Base on your code posted above,

It is like you are using CMD and looking for that file by googling the folders, am i right?

When i double clicked that batch file, is it automatically execute my TEMP.COM file?

If yes, then this is the answer ive been waiting for...
_______________ _______________ _______________ _______________ _____
Yes, you guessed absolutely right.
In my code above, I'm just GOOGLING (a better word is browsing) the folders (as you guessed).
Then when I'm in the directory (or folder) of my choice i.e. the folder that contains TEMP.COM, I simply execute the file temp.com

THAT'S IT........(isn' t that simple and powerful)

So you can simply modify the code very easily to do your job.
_______________ _______________ _______________ _______________ _____
If you still face any problem, do tell me. I will help you out.
_______________ _______________ _______________ _______________ _____
HOPE THIS HELPS.......... .............
Mar 2 '08 #4
sukatoa
539 Contributor
_______________ _______________ _______________ _______________ _____
Yes, you guessed absolutely right.
In my code above, I'm just GOOGLING (a better word is browsing) the folders (as you guessed).
Then when I'm in the directory (or folder) of my choice i.e. the folder that contains TEMP.COM, I simply execute the file temp.com

THAT'S IT........(isn' t that simple and powerful)

So you can simply modify the code very easily to do your job.
_______________ _______________ _______________ _______________ _____
If you still face any problem, do tell me. I will help you out.
_______________ _______________ _______________ _______________ _____
HOPE THIS HELPS.......... .............

You got the best idea...

Thank you bro, I will ask you soon about batch file if i have another problem..

Thanks again..
Mar 3 '08 #5
sukatoa
539 Contributor
I like to implement the behavior of the batch file being executed...

Suppose the batch file executes the .COM file...

That .COM file is the A86 Compiler generated file...

If after the .COM file execution, ( I will terminate )

How can i terminate the batch file that was invoked from java?

I mean, if the batch file invoked, the .COM file executes because the batch file invokes the .COM file...

If i will end the .COM file process (terminate the program), the DOS Prompt still executing...

How can i terminate that also?
Mar 7 '08 #6
sukatoa
539 Contributor
The program now is under test process...

They suggest that it would be nice if i will terminate the DOS Prompt being executed by the batch file after the (Program) .COM file terminated...
(automatically terminates the DOS after terminating program..)


Because, it takes a little bit of time if they were to close the DOS Prompt by clicking the x(close) or typing the "exit" command..

Is it possible? bro?



I already posted my thread about this in Java forum, as of now, no replies...

Hoping for possibilities
Sukatoa..
Mar 7 '08 #7
AmberJain
884 Recognized Expert Contributor
The program now is under test process...

They suggest that it would be nice if i will terminate the DOS Prompt being executed by the batch file after the (Program) .COM file terminated...
(automatically terminates the DOS after terminating program..)


Because, it takes a little bit of time if they were to close the DOS Prompt by clicking the x(close) or typing the "exit" command..

Is it possible? bro?



I already posted my thread about this in Java forum, as of now, no replies...

Hoping for possibilities
Sukatoa..
_______________ _______________ _______________ _______________ _____
As in the sample batch file in my reply #2 above, if you want to exit the batch file, simply add the statement "exit" and then [enter] or [return]at the end of the batch file. For example, suppose the following batch file------->
+++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++
cd\
c:
cd windows
cd system32
dir
exit

+++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++
Note the command "exit" at the end of the above batch file which exits a batch file.

This is what I could think is your problem. If this is not your problem or this does not solves your problem, do tell me. I will try my best to help you out.
_______________ _______________ _______________ _______________ _____
HOPE THIS HELPS.......... ..
Mar 8 '08 #8
sukatoa
539 Contributor
_______________ _______________ _______________ _______________ _____
As in the sample batch file in my reply #2 above, if you want to exit the batch file, simply add the statement "exit" and then [enter] or [return]at the end of the batch file. For example, suppose the following batch file------->
+++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++
cd\
c:
cd windows
cd system32
dir
exit

+++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++
Note the command "exit" at the end of the above batch file which exits a batch file.

This is what I could think is your problem. If this is not your problem or this does not solves your problem, do tell me. I will try my best to help you out.
_______________ _______________ _______________ _______________ _____
HOPE THIS HELPS.......... ..
Yah, i added the exit, but it doesn't do the termination....

Here is the scenario,
After invoking linker.bat, the .COM file executes...

When i terminate the .COM file, it goes back to the cmd.exe...
Not in batch file....

I have a new idea....
Is there a technique using batch file that would terminate the MSDOS prompt(Still running state)....?

Update me...
Mar 11 '08 #9
AmberJain
884 Recognized Expert Contributor
Yah, i added the exit, but it doesn't do the termination....

Here is the scenario,
After invoking linker.bat, the .COM file executes...

When i terminate the .COM file, it goes back to the cmd.exe...
Not in batch file....

I have a new idea....
Is there a technique using batch file that would terminate the MSDOS prompt(Still running state)....?

Update me...
Last time when I replied, I couldnot understand your problem completely. Hope this time I am rightly interpreting your problem.
Yes, there's a way to do as you suggested (YOUR IDEA) in your reply.

Check out this. It might help.

Suppose your batch file is as follows ------------>
_______________ _______________ _______________ _______________ _____
cd\
d:
cd documents and settings
cd user
cd my documents
cd files
scrsvr.com
pause
exit

_______________ _______________ _______________ _______________ _____

Note first of all I browse to directory

d:\documents and settings\user\M y documents\files

and execute the file scrsvr.com.
When I am completed with scrsvr.com, I exit scrsvr.com and find that batch file is waiting for me with message "Press any key to continue....." displayed on command prompt. When I press any key on keyboard, the next command "exit" in my batch file executes and I exit the command prompt.

I mean to say that command "pause" in a batch file waits for any key to be pressed by the user and then only it proceeds with the execution of batch file. You can also include "pause" command multiple times in your batch file (as many times as you wish) at multiple places. Furthermore this do mean that you can also include any command after "pause" command.
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
If you still face any problem, do tell me. I will help you out.
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
HOPE THIS HELPS.......... ......
Mar 11 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
17742
by: DBA | last post by:
I have a windows batch file that executes a SQL Server bcp command. I would like to obtain a return code if the bcp command fails. However, I cannot seem to find the return code (if any) for bcp. For example, if the bcp command is improperly formatted, or has a bad password, I want the batch file to return an error. Right now, my batch file simply executes and returns success, even when the bcp command fails. Has anyone run into this...
0
10160
by: SkySea | last post by:
Hi! Any help on this would be appreciated... In an HTML document that lists instructions on installing some software, there's a point where a DOS batch file needs to be run in order to copy files from the CD to the hard drive. Given that CD drives can have various names, I wanted to run the batch file using relative paths. The problem is, the DOS window that opens to run the batch file can leave the command prompt at any location . So...
14
3564
by: Mark C. | last post by:
I'm trying to call a batch file that I've built using the FileSystemObject and CreateObject("Wscript.Shell"), oShell.Run... in an asp script. Naturally, I can get the script to work from a command line but not from a browser. The page does not throw an error but the oShell.Run... portion of the script doesn't run. Any help would be appreciated. Thanks.
4
47560
by: Bill | last post by:
I need help closing a CMD window when it is executed from Access. 1) The batch file is called from Access. 2) Access closes, 3) the batch runs a copy of the access database (creating a backup) 4) Once the copy is complete, the batch file opens the Access database again 5) EXIT should close out the cmd window but it does not execute that line
3
4486
by: emman_54 | last post by:
Hi every one, I am trying to run a batch file using my asp.net application. I am using the Process class to run the batch file. When I run my web application, In the task manager, i could see cmd.exe with ASPNET as a user. But nothing happens. It can't execute the batch file. This is the code i am using to run the batch file:
1
24316
by: steve | last post by:
Hi all, Here's some work in progress that should allow you to run a batch file as a custom action in a VS deployment project. Yup I know you can use js or wsh, but the target may not have either.. Essentially it's just a wrapper for the Process class and a command interpreter. Warning, it only partly works. I had wanted to pass in (a) The name of the batch file (through "BatchFileName"), and
14
12840
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my windows applicationm, i need to excute a batch file. this batch file throws some text and questions to the screen, i need to catch the standard Output, check if it's a question, in case it's a question, i want to popup a messageBox or something, and bring back to the batch file the result (Yes\No question). I know how to excute the batch file and get all the Standard output at the end, but i don't know who can i read it line by...
0
1496
by: =?Utf-8?B?UnVzdHlfUm9zZXI=?= | last post by:
Hi everyone, I'm having some issues figuring out how to complete certain tasks with a batch file, whether it be not knowing the right syntax or if it can even be accomplished with a batch file. Heres my problem. I work in the IT department at a local bank and we are in the process of deploying new PCs for some of the employees with older work stations. I just finished staging about a dozen of them and in the next month or so we will...
0
979
by: PradeepChabukswar | last post by:
How to find Total Number of Partition and their name on windows system through Batch file? Is there any Language for this? Also how can we Program to make some filehadling?
0
9901
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9750
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10672
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10744
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7077
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5738
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4150
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.