About batch file!!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    About batch file!!!

    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
  • AmberJain
    Recognized Expert Contributor
    • Jan 2008
    • 922

    #2
    Originally posted by sukatoa
    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.........

    Comment

    • sukatoa
      Contributor
      • Nov 2007
      • 539

      #3
      Originally posted by ambrnewlearner
      _______________ _______________ _______________ _______________ _____
      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,

      Code:
      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...

      Comment

      • AmberJain
        Recognized Expert Contributor
        • Jan 2008
        • 922

        #4
        Originally posted by sukatoa
        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.......... .............

        Comment

        • sukatoa
          Contributor
          • Nov 2007
          • 539

          #5
          Originally posted by ambrnewlearner
          _______________ _______________ _______________ _______________ _____
          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..

          Comment

          • sukatoa
            Contributor
            • Nov 2007
            • 539

            #6
            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?

            Comment

            • sukatoa
              Contributor
              • Nov 2007
              • 539

              #7
              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..

              Comment

              • AmberJain
                Recognized Expert Contributor
                • Jan 2008
                • 922

                #8
                Originally posted by sukatoa
                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.......... ..

                Comment

                • sukatoa
                  Contributor
                  • Nov 2007
                  • 539

                  #9
                  Originally posted by ambrnewlearner
                  _______________ _______________ _______________ _______________ _____
                  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...

                  Comment

                  • AmberJain
                    Recognized Expert Contributor
                    • Jan 2008
                    • 922

                    #10
                    Originally posted by sukatoa
                    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.......... ......

                    Comment

                    • sukatoa
                      Contributor
                      • Nov 2007
                      • 539

                      #11
                      Originally posted by ambrnewlearner
                      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.......... ......
                      Roger...

                      I got it....

                      Thank you bro..

                      I am facing a new problem again...

                      About my .COM file........... .

                      As my a86 code getting bigger, making a "simple calculator"...

                      The batch file now cannot invoke properly the .COM file...

                      Can i have your email address? i would like this .COM file to be test in you...

                      Maybe you can invoke it properly...

                      Thanks again...

                      Comment

                      • AmberJain
                        Recognized Expert Contributor
                        • Jan 2008
                        • 922

                        #12
                        Originally posted by sukatoa
                        Roger...

                        I got it....

                        Thank you bro..

                        I am facing a new problem again...

                        About my .COM file........... .

                        As my a86 code getting bigger, making a "simple calculator"...

                        The batch file now cannot invoke properly the .COM file...

                        Can i have your email address? i would like this .COM file to be test in you...

                        Maybe you can invoke it properly...

                        Thanks again...
                        You can upload the file on the RAPIDSHARE (www.rapidshare.com/), MEGAUPLOAD (with a free account available on these sites) or any other uploading site and then post the address of the page which hosts that file in this thread. I will then download that file and then help you out.

                        Alternatively, if you need my e-mail address, here it is----->
                        newlearner.ambr @gmail.com

                        REMEMBER to notify me in this thread when you have mailed me the .com file.
                        As I don't check out mails for this account too often. When you would have sent the mail, I would check it out exclusively.
                        Don't spam me please....
                        _______________ _______________ _______________ _______________ _____
                        (As always) Hope this helps.......... .

                        Comment

                        • sukatoa
                          Contributor
                          • Nov 2007
                          • 539

                          #13
                          Originally posted by ambrnewlearner
                          You can upload the file on the RAPIDSHARE (www.rapidshare.com/), MEGAUPLOAD (with a free account available on these sites) or any other uploading site and then post the address of the page which hosts that file in this thread. I will then download that file and then help you out.

                          Alternatively, if you need my e-mail address, here it is----->
                          newlearner.ambr @gmail.com

                          REMEMBER to notify me in this thread when you have mailed me the .com file.
                          As I don't check out mails for this account too often. When you would have sent the mail, I would check it out exclusively.
                          Don't spam me please....
                          _______________ _______________ _______________ _______________ _____
                          (As always) Hope this helps.......... .
                          Don't worry, im not a spammer, i am a programmer.... ;-)

                          You are a good guy, why should i spam you?....

                          I have sent the .COM file....

                          My batch file looks like this,

                          FINAL2.COM

                          That was only the content of the batch file....

                          I put it beside the FINAL2.COM

                          So, when i clicked that batch file, nothing wrong....

                          But when my program, made in java invokes that batch file, it does nothing on the flow...

                          It was just a black black screen, the cursor sets at 0,0 (x,y)

                          Whatever i click, no response...

                          Until, the system prompts me to close the program....


                          Update me....

                          Comment

                          • AmberJain
                            Recognized Expert Contributor
                            • Jan 2008
                            • 922

                            #14
                            Originally posted by sukatoa
                            Don't worry, im not a spammer, i am a programmer.... ;-)

                            You are a good guy, why should i spam you?....

                            I have sent the .COM file....

                            My batch file looks like this,

                            FINAL2.COM

                            That was only the content of the batch file....

                            I put it beside the FINAL2.COM

                            So, when i clicked that batch file, nothing wrong....

                            But when my program, made in java invokes that batch file, it does nothing on the flow...

                            It was just a black black screen, the cursor sets at 0,0 (x,y)

                            Whatever i click, no response...

                            Until, the system prompts me to close the program....


                            Update me....
                            SORRY FOR THE INCONVENIENCE.. ............... .........
                            Something went wrong probably. Actually when I checked the inbox of newlearner.ambr @gmail.com, I couldnot find your mail. That means it's not delievered to me. So I did what I can.
                            I mailed my another mail ID (mail account on yahoo) to your ID which is mentioned below :
                            ghize_adt@yahoo .com

                            I found this ID on your profile page at :
                            YOUR PROFILE

                            Check out my offline mail at yahoo login page at:
                            It's time to get stuff done with Yahoo Mail. Just add your Gmail, Outlook, AOL or Yahoo Mail to get going. We automatically organize all the things life throws at you, like receipts and attachments, so you can find what you need fast. Plus, we've got your back with other convenient features like one-tap unsubscribe, free trial expiration alerts and package tracking


                            I hope I mailed my yahoo mail ID to your valid mail ID. Now as you receive that mail, check out my ID in it and mail me the .com file on that ID (Again sorry for the inconvenience). I know you might be cursing me right now, but what can I do if I cannot receive your mail on gmail ID. Actually I am quite used to yahoo mail than to gmail. So mail me .com file at yahoo ID.

                            REMEMBER to notify me in this thread when you have mailed me the .com file to my yahoo ID.
                            _______________ _______________ _______________ _______________ _____
                            WAITING FOR YOUR REPLY..........

                            Comment

                            • sukatoa
                              Contributor
                              • Nov 2007
                              • 539

                              #15
                              Originally posted by ambrnewlearner
                              SORRY FOR THE INCONVENIENCE.. ............... .........
                              Something went wrong probably. Actually when I checked the inbox of newlearner.ambr @gmail.com, I couldnot find your mail. That means it's not delievered to me. So I did what I can.
                              I mailed my another mail ID (mail account on yahoo) to your ID which is mentioned below :
                              ghize_adt@yahoo .com

                              I found this ID on your profile page at :
                              YOUR PROFILE

                              Check out my offline mail at yahoo login page at:
                              It's time to get stuff done with Yahoo Mail. Just add your Gmail, Outlook, AOL or Yahoo Mail to get going. We automatically organize all the things life throws at you, like receipts and attachments, so you can find what you need fast. Plus, we've got your back with other convenient features like one-tap unsubscribe, free trial expiration alerts and package tracking


                              I hope I mailed my yahoo mail ID to your valid mail ID. Now as you receive that mail, check out my ID in it and mail me the .com file on that ID (Again sorry for the inconvenience). I know you might be cursing me right now, but what can I do if I cannot receive your mail on gmail ID. Actually I am quite used to yahoo mail than to gmail. So mail me .com file at yahoo ID.

                              REMEMBER to notify me in this thread when you have mailed me the .com file to my yahoo ID.
                              _______________ _______________ _______________ _______________ _____
                              WAITING FOR YOUR REPLY..........
                              No, cursing?!! hahahhh no.... ;-)

                              It is just a normal thing... Nobody is perfect right....?
                              I will try again...

                              Comment

                              Working...