How to run a batch file upon entering DOS

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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!
 

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.
 

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.
 

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.
 

WhitPhil

Gone but never forgotten
Trusted Advisor
Joined
Oct 4, 2000
Messages
8,684
Squashman said:
Use this as the shortcut.

cmd /k batfilename.bat
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!! :)
 

Squashman

Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
WhitPhil said:
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!! :)
Probably because the file is not in your path.
 
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.
 

islandpilot

Thread Starter
Joined
Apr 17, 2004
Messages
16
Squashman said:
Use this as the shortcut.

cmd /k batfilename.bat
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!
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Top