Questions tagged [dos]

A family of disk-based operating systems (Disk Operating System) for mainframes and minicomputers in the 1960s and 1970s, and subsequently IBM PCs and compatibles of the 1980s and 1990s, including MS-DOS. DO NOT USE THIS TAG FOR QUESTIONS ABOUT THE WINDOWS COMMAND PROMPT! Instead, use the [windows], [batch-file], [windows-console], and/or [cmd] tags. For questions about denial-of-service (DoS) attacks, use [denial-of-service].

DOS (Disk Operating System) is a generic name for the simplest possible operating system that can handle a disk. Examples abound from the 1950s onwards, from all major manufacturers. IBM and Digital Equipment Corporation (among others) supplied a DOS as a bootstrap operating system used to generate larger ones.

The best known and most commonly used examples of DOS are for the IBM PCs and compatibles of the 1980s and 1990s. Members of this family include Microsoft's MS-DOS, IBM's PC-DOS, Digital Research's DR-DOS, Novell DOS, FreeDOS, and others.

Between enthusiasts and legacy environments, there remains a high level of interest in MS-DOS systems and applications, whether running on real vintage hardware or under a virtual machine such as DOSBox. Programming questions about DOS are on-topic for Stack Overflow. Other types of questions should be directed to Retrocomputing.

Early consumer versions of Windows (1.x, 2.x, 3.x, the 9x series, up to Windows Millennium) were built atop of or partially based upon MS-DOS. Windows NT, Windows XP, and later do not use MS-DOS. Since modern versions of Windows are not based on DOS, questions about the Windows command prompt and batch scripts should not use this tag. Instead, use the tags , , , and/or .

Another common usage of this acronym is for denial-of-service attacks. This is generally spelled with a lowercase "o" (DoS), and is not related to the operating system DOS. For these questions, use the tag . A tag also exists for distributed denial-of-service attacks.

2768 questions
281
votes
13 answers

How to create empty text file from a batch file?

Can somebody remember what was the command to create an empty file in MSDOS using BAT file?
m_pGladiator
  • 8,462
  • 7
  • 43
  • 61
242
votes
5 answers

Recursive directory listing in DOS

How do we achieve a recursive directory listing in DOS? I'm looking for a command or a script in DOS which can give me the recursive directory listing similar to ls -R command in Unix.
StarDotStar
  • 2,865
  • 3
  • 20
  • 15
196
votes
7 answers

MS-DOS Batch file pause with enter key

Is it possible in MS-DOS batch file to pause the script and wait for user to hit enter key? I wish to do this inside a for loop. After each iteration, I want the script to pause and wait for user to hit 'Enter'
dr_rk
  • 4,395
  • 13
  • 48
  • 74
134
votes
3 answers

What is the at sign (@) in a batch file and what does it do?

One remotely familiar with windows/dos batch scripting will recognize this line: @echo off For many-many days, I was happy with the sentiment that the @ is how echo off is meant to be written at the top of the batch and that's it. However, recently…
n611x007
  • 8,952
  • 8
  • 59
  • 102
130
votes
7 answers

Commenting multiple lines in DOS batch file

I have written huge MS DOS Batch file. To test this batch file I need to execute some lines only and want to hide/comment out remaining. I have some existing comment lines starting with :: hence I cannot use :: anymore as it will scramble all…
user219628
  • 3,755
  • 8
  • 35
  • 37
111
votes
11 answers

How can I debug a .BAT script?

Is there a way to step through a .bat script? The thing is, I have a build script , which calls a lot of other scripts, and I would like to see what is the order in which they are called, so that I may know where exactly I have to go about and add…
Vhaerun
  • 12,806
  • 16
  • 39
  • 38
88
votes
11 answers

What ever happened to deltree, and what's its replacement?

In earlier versions of MS-DOS - I want to say version 7, but I could be wrong - there was a deltree command, which recursively deleted all subdirectories and files from a given path. deltree no longer exists, but del didn't seem to inherit the…
David Koelle
  • 20,726
  • 23
  • 93
  • 130
72
votes
7 answers

How to get a list of sub-folders and their files, ordered by folder-names

Can I use dir command-line to get a list of sub-folders and their files, ordered by folder-names, and not just file-names ? using dir /s/b/o:gn > f.txt I first get all sub-folders and only then all sub files, e.g.: d:\root0\root1\folderA …
Atara
  • 3,523
  • 6
  • 37
  • 56
71
votes
5 answers

copy all files and folders from one drive to another drive using DOS (command prompt)

i want to copy all files and folders from one drive to another drive using MS-DOS. How to do it? I am trying xcopy I:\*.* N:\ But it copies only files, not folders. So how to copy all files and folders both? Thanks.
gautamlakum
  • 11,815
  • 23
  • 67
  • 90
57
votes
5 answers

How do I increment a DOS variable in a FOR /F loop?

I'm trying to read text lines from a file, and increment a counter so I can eventually simulate an array in DOS. I'd like to be able to store the lines of text in a DOS array for further processing. My current attempt is: set…
Mike
  • 593
  • 1
  • 5
  • 5
50
votes
8 answers

DOS BAT file equivalent to Unix basename command?

Is there an easy way to get to the basename (file name without extension) of a DOS file name using the DOS BAT command language? I agree: format c:\ is probably a good start, followed by a bootable Linux CD (assuming these antique machines have a CD…
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
46
votes
9 answers

How to increment variable under DOS?

I've spent the past 3hrs trying to work this out but just couldn't find a solution. Here's my batch script: if NOT Exist Counter.txt GOTO START Type c:\counter.txt if %COUNTER% EQU %Cycles% goto Pass if NOT %COUNTER% EQU %Cycles% goto…
shadowz1337
  • 710
  • 1
  • 8
  • 21
33
votes
4 answers

How were graphical DOS Games written?

I always wondered how the DOS games like Sky Roads, Turbo, Aladdin, Duke Nukem, Commander Keen 6 were written. I cannot find a good source. If I write a console application in C#, C++, Java etc.. It is always displayed and remains still. And it is…
Mustafa
  • 10,013
  • 10
  • 70
  • 116
32
votes
4 answers

How to return to the original directory after invoking change directory in DOS batch?

I want to create a batch file, batch.bat, that accepts 2 mandatory arguments: %1 represents a path relative to the current directory. %2 represents a filaname. Assume the current directory is father\me\. User can use this batch as follows: batch…
Second Person Shooter
  • 14,188
  • 21
  • 90
  • 165
29
votes
6 answers

Command line to delete matching files and directories recursively

How can I recursively delete all files & directories that match a certain pattern? e.g. remove all the ".svn" directories and the files they contain? (Sadly DOS only)
Rory
  • 40,559
  • 52
  • 175
  • 261
1
2 3
99 100