Help - Search - Members - Calendar
Full Version: Running DOS program in WinXP
Scot's Newsletter Forums > Main > All Things Windows
ibe98765
I have some applications that run in a DOS window in WinXP. But when I try to run one of these by double-clicking from Explorer, I see the DOS window flash open and close right away. To run it, I have to open a DOS window at the folder and then manually type in the name of the program to run. How can I fix this.

btw: Had the same problem with Win2k.
SonicDragon
Tight click on the program and go to the combatabily tab. You could try running it in Win 95 or 98 and see if that works but i don't think it will.

If that doesn't work, which i don't think it will, there is.... a workaround.

If your program is located in:

C:\Program Files\My Program\program.exe

Then we can have the dos window start in:

C:\Program Files\My Program\

if your program is the only program in there that begins with "p", you could just type p and then Tab and it will automatically fill in the rest.

I know this can be done, i just have to find out how. I'll be back. wink.gif
SonicDragon
Ok i found it.

Right Click Destop > New > Shortcut

type in C:\WINDOWS\SYSTEM32\cmd.exe for the program (you may need to chage this is for cmd program isn't located there)

Name it whatever you want and click finish.

There should not be a new icon on your desktop.

Right click that > Properties > Shortcut Tab

In there, there should be a text box labeled "Start in". In that text box, put, C:\Program Files\myprogram\

and that will start cmd.exe in the correct folder smile.gif

Hope this helps smile.gif
ibe98765
Starting a DOS prompt in the proper folder/directory is easy. I just right-click on the folder and click "DOS Prompt Here".

What I want to get to the bottom of is WHY double-clciking on the DOS program name doesn't keep the DOS window open and run the program, like it should.
SonicDragon
QUOTE
Starting a DOS prompt in the proper folder/directory is easy. I just right-click on the folder and click "DOS Prompt Here".


Well now you tell me dry.gif

Anyway, the program exits once it's done doing whatever it's doing. That's how most DOS programs are written. When you open it in the DOS Prompt, it still runs and exits once it's done doing whatever it's doing, but the DOS Prompt still remains, it just the program that closed...

I know that didn't make much scence. It's just how their written.
ibe98765
QUOTE (SonicDragon @ Jul 12 2003, 11:55 AM)
QUOTE
Starting a DOS prompt in the proper folder/directory is easy. I just right-click on the folder and click "DOS Prompt Here".


Well now you tell me dry.gif

Anyway, the program exits once it's done doing whatever it's doing. That's how most DOS programs are written. When you open it in the DOS Prompt, it still runs and exits once it's done doing whatever it's doing, but the DOS Prompt still remains, it just the program that closed...

I know that didn't make much scence. It's just how their written.

No, that isn't it. Maybe an example would serve better here. This is only 1 example of many.

If you are running WinXP SP 1, go to http://www.otbsw.com/ and download the program called ENVREP. Install it on your machine (it won't hurt anything). After install, try to run the .exe file (it runs in a DOS window). When I double-click on the exe file the DOS window opens and closes immediately. What it needs to do is stay open, so I can run some parameters on the exe line.

If I manually open a DOS prompt and type the command ENVREP on the command line with no parametrs, I get the help text displayed. So even if there aren't any parameters, the DOS window should stay open with the help text displayed.

Clear now?
arekyyz
Would it not make more sense to create a shortcut (.pif file) of this DOS application and that way you could specify in the shortcut itself the parameters it should be running.

At work we have an old DOS application that some of the staff need to use and that is how we run it...

Arek.
snoepie
Rightclick on the executable DOS-file. Choose <properties> <program> and disable <close window on exit>. In my experience I mostly end up with a empty black screen. In most cases you have to add the proper DOS commands in autoexec and config and check the memory-settings the DOS executable needs.
greengeek
rolleyes.gif

With the next version of Windows not supporting any type of DOS wouldn't it be better to try and find alternatives for DOS applications?
snoepie
Or (if there are no alternatives) create a DOS-partition or DOS removable harddrive or use an old computer only for DOS?
greengeek
rolleyes.gif

That's what I do for DOS programmes, use the older computers that can't run anything better than Win98 and aren't in use by Linux!
Marsden11
The reason it closes is because you are not operating in a "DOS" envirnonment like you were in any of the 9X flavors. Now you are in a pure 32bit environment where the user mode is completely seperate from kernel mode. If you want to run DOS, you need to run in a virtual DOS environment.
You need to specify in the "pif" (program information file) file any DOS environmental settings.

There are numerous Knowledge Base Articles

#37242
#77083
#87165
#134399
#74210

Here is a great place to start with...

DOS apps in Windows XP
ibe98765
I think we are getting off track here. It isn't that the program doesn't run - it's just that the DOS window DOESN'T stay open at the run from directory to allow me to enter parameters for the program. So a two-step approach to running such a program is required. First, open the DOS window. Second, type in the program name and parameters.

Is this the normal design of WinNT systems? What I want to find out is - Is everyone else having the same problem or is there a problem with my system?
Marsden11
What you want begins before you even start the DOS program. READ the links provided...
ibe98765
QUOTE (Marsden11 @ Jul 13 2003, 07:12 PM)
What you want begins before you even start the DOS program. READ the links provided...

Thanks, but that's just too heavy for me man...
Marsden11
Prior to creating or making changes to the PIF, please review the MS-DOS-based program documentation. Changing the PIF affects how the program interacts with Windows. The program might only work correctly with specific default settings.

--Compatible timer hardware emulation enables MS-DOS-based programs to reduce the rate at which the computer's timer sends timing signals. The faster the processor speed of your computer (200 megahertz (MHz), 300 MHz, and so on), the faster the signals travel between the hardware and the software enabling most Windows-based programs to work more efficiently.

--Most MS-DOS-based programs were not originally designed with fast processor speeds in mind. If an MS-DOS-based program sets the rate too high during installation, it might not run. Select this check box only after reviewing the accompanying program documentation. Otherwise, this might degrade the program's performance or affect the program's ability to calculate time.

--When you change any settings in an MS-DOS-based program, a PIF is automatically created. The settings you specify will be used each time you start the program by double-clicking its icon. If you start the program from a command prompt window, these settings won't be used.
JCCinCalifornia
QUOTE (ibe98765 @ Jul 13 2003, 11:28 PM)
Thanks, but that's just too heavy for me man...
*
JCCinCalifornia
I was having the same open/close dos window problem as well.

Turns out you need to click on run -- then type CMD into the request window.
Next after hitting the enter key the dos window will stay open.
Now type in the program you wish to run at the prompt.
Benjamin
My solution: Insert a Pause command.

This was an easy fix for me. My.bat files were closing before I had an opportunity to view the echo. I simply added a "Pause" command at the end of the batch file and the screen remained open until I pressed any key.
degustibus
QUOTE (Benjamin @ Apr 6 2006, 07:19 PM) *
My solution: Insert a Pause command.

This was an easy fix for me. My.bat files were closing before I had an opportunity to view the echo. I simply added a "Pause" command at the end of the batch file and the screen remained open until I pressed any key.



I run dos programs and batch files regularly from both XP and Win2K -- without problems. No pause command unless doing a dir command.

I have a command link on my desktop -- whenever I want to run a dos program or batch file, I open the window and run it -- of course I have added a path change in my environment to include c:\bat -- .

I use a Wordstar dos window, set up through a command window -- not using a pif. I also run an old quick and dirty database, a file manager (DF--Directory Freeddom, Version 2.11 3/89, by Gordon Haff) and a search program (FFF, File Finder Pac, Version 5.2, March 14, 1996, by Jim Derr), DM2 (DIRMATCH by PC Mag ), two quick directory changers (go.com by Jeff Owens & LCD Led's Change Directory v2.1, by Jim Ledbetter -- LCD is tricky because of entry limits)) as well as Laplink3 (a golden oldie). All run nicely in XP and Win2K. All these run from a command window, with appropriate path settings.

Once a month I use a virtual machine to run some dos stuff that won't run in Win98x, but work fine in Dos 6.2 ( I'm talking about DataStar's formsort program, just will not sort right in Win98 up.)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.