1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

How to run a batch file upon entering DOS

Discussion in 'Windows XP' started by islandpilot, Jul 19, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. islandpilot

    islandpilot Thread Starter

    Joined:
    Apr 17, 2004
    Messages:
    16
    In Win Xp, am trying to do what i always did in Win 98
    upon going into DOS...namely, running a BAT file automatically.

    Win98 had a "start in" option, and a "batch file" option,
    so that i could tell it what folder to put me into, and
    what batch file to execute.

    Win XP "Command Prompt Properties" has the
    'start in' box, but not the "batch file" box.
    Surely Win XP can do this....but how?

    THANKS!
     
  2. WhitPhil

    WhitPhil Gone but never forgotten Trusted Advisor

    Joined:
    Oct 4, 2000
    Messages:
    8,684
    I've never done it, but the CMD command has parameters that appears that it will run a task specified in the registry. (at the C: prompt enter cmd /? )

    So, you could create a BAT file that runs CMD with this AutoStart task (in your case the BAT job you wish to run), and use this as the entry to DOS vs the normal mechanism.
     
  3. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    I don't see the point of this. When you run a .bat file it will automatically open up a CMD prompt. Not sure what the point of this is.
     
  4. WhitPhil

    WhitPhil Gone but never forgotten Trusted Advisor

    Joined:
    Oct 4, 2000
    Messages:
    8,684
    What Islandpilot was looking for was the capability of opening a DOS prompt and having a BAT file executed automatically. (and then, I am presuming, leaving them at the C:\ prompt to do whatever).

    My "crude" solution, was to first review the parameters to CMD, which appear to allow it to execute a predefined task (which could obviously be that BAT file they wish to run).

    Then, build a BAT file that contains only the CMD command, along with the needed parameters.

    Now, instead of heading to DOS in the normal way, they would use this BAT file instead, which "should" open a DOS window, and run the BAT task, and leave them at the command prompt.
     
  5. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    Use this as the shortcut.

    cmd /k batfilename.bat
     
  6. WhitPhil

    WhitPhil Gone but never forgotten Trusted Advisor

    Joined:
    Oct 4, 2000
    Messages:
    8,684
    Ah! Substantially easier. I got hung up on the BAT file and missed the whole forest.
    BTW it appears the the "K" parameter needs the full path to the file, but regardless, this should fill the bill!! :)
     
  7. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    Probably because the file is not in your path.
     
  8. ozrom1e

    ozrom1e

    Joined:
    May 15, 2006
    Messages:
    11,849
    I did not think there is a MS-DOS in Windows XP. The command prompt is as close as you are going to get but is isnot DOS.
     
  9. islandpilot

    islandpilot Thread Starter

    Joined:
    Apr 17, 2004
    Messages:
    16
    Squashman....thanks for the solution....i had not used the "/k"
    switch in my attempts to parse a batch file in the
    Command Prompt "Target" box.

    Appreciate your help!
     
  10. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/484532

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice