Reputation: 111
Whenever I try to execute a batch file, even a simple one, it prints the whole thing out instead of executing it. I have tried it on MS-DOS 3.3 and 4.0, both do this. If I execute each command individually in the command prompt though they work (so if I type "pause" in the command prompt it will pause, same with the other commands). The batch file executes fine in Windows 2000 (the only computer I had that can read 720k floppy disks)
My code is below, named test.bat
:
@echo off
cls
echo Hello World!
pause
What it looks like when executed, the text saying test at the top being the program name I executed:
Upvotes: 11
Views: 1137
Reputation: 81
As others have mentioned in the comments, your test.bat file doesn't contain the invisible carriage return characters - only linefeed characters. That's fine for Unix/Linux, but DOS needs both. The whole file is being treated as one line.
Since this is a simple file, you could just retype it with the command copy con test.bat
and type CTRL+Z
when you are finished. Unfortunately, this will only let you create new files, not edit existing ones.
As you've discovered, MS-DOS 4 predates the edit
command. But it did come with another (more annoying) text editor: edlin
.
You can only edit one line at a time and the keyboard controls are not exactly intuitive, so check out this link for details on navigating the interface: http://www.computerhope.com/edlin.htm
Upvotes: 1
Reputation: 1
To make the answer easily accessible to all users:
To prepare and run a DOS batch file in MS DOS:
- copy DOS apps edit.com and qbasic.exe to your MS-DOS disk
- type your batch file in edit.com, do not use word processors
- run it in MS-DOS. It should work fine.
Upvotes: 0