kb0010 - Deleting files in MS-DOS without a prompt.

Issue:

Deleting files in MS-DOS without a prompt.

Cause:

To help prevent files from becoming accidentally deleted Microsoft will warn you before deleting files or folders.

Solution:

By default Microsoft Windows will not prompt a user or give a user a prompt or warning when deleting files on a computer using the del command. However, when attempting to delete a directory using the deltree or rmdir command on a directory that is not empty you will receive a warning and/or error message about deleting the directory.

To suppress the prompting use the deltree command and add the tag /y. Here is an example of how the whole command would look, deltree c:\windows\temp\*.* /y However, this does not work in all versions of Windows and or DOS.

If this command does not work we would recommend that you create a batch file with the below command in the batch file.

echo y | del %1\*.*

Once created, you can type the name of the batch file then the name of the directory that you wish to delete.

Microsoft Windows 2000 and Windows XP users

Users who wish to delete a directory containing files in a MS-DOS session running under Microsoft Windows 2000 or Windows XP can also use the rmdir or rd command with the /S option.

Please remember that when you delete files or directories from the computer they are permanently removed, so be careful! Microsoft Windows 95, Windows 98, Windows ME, Windows NT, Windows 2000, Windows XP, and later versions of Windows users deleting files through MS-DOS should realize that all deleted files will not be sent to the recycle bin.

Other users using MS-DOS through Windows

Users running MS-DOS through later versions of Microsoft Windows can also utilize the erase command to delete files without a prompt. Microsoft Windows 95, Windows 98, Windows ME, Windows NT, Windows 2000, Windows XP, and later versions of Windows users deleting files through MS-DOS should realize that all deleted files will not be sent to the recycle bin.

kb2005 - Technical Support (SDK)

Knowledge Base
Issue / Question
kb0010Deleting files in MS-DOS without a prompt.
kb0036How to execute commands in a batch file in timed intervals.
kb0209Information about long file names.
kb0319Creating a blank line in a batch file.
kb0321How to shut down / restart the computer with a batch file.
kb0322How to run a batch file each time the computer boots.
kb0323How to quickly replace the file extensions of several files.
kb0435How to make a bat executable?
kb0738Preventing a MS-DOS window from automatically closing in Windows.
kb0754Deleting files equal to 0 in a batch file.
kb0785How can I run a batch file at a specific time?
kb0932How can I run a batch file or other file minimized?
kb0987How can I make a batch file rename a file to the date or time?
kb0050How can I loop or start a batch file over after it has completed?
kb0952Searching for a string of text in a MS-DOS batch file.

kb2004 - Batch commands (SDK)

Just like all MS-DOS commands, all batch file commands are not case sensitive. However, in the below listing we have listed all commands in all caps to help you identify what is a command and what is not.


@Does not echo back the text after the at symbol. This is most commonly used as @ECHO OFF to prevent any of the commands in the batch file from being displayed, just the information needed.

%1The percent followed by a numeric value, beginning with one, allows users to add variables within a batch file. The below line is an example of what can be used in a batch file.

ECHO Hello %1

When the above one-line batch file is created, add your name after the batch file. For example, typing myname (being the name of the bat file) and then your name:

myname bob

would output:

Hello bob

Note: This can be extended to %2, %3, and so on.


::One of two ways of adding remarks into the batch file without displaying or executing that line when the batch file is run.

:LABELBy adding a colon in front of a word, such as LABEL, you create a category, more commonly known as a label. This allows you to skip to certain sections of a batch file such as the end of the batch file. Also see GOTO.

CALLThis is used to run another batch file within a batch file. When the batch file that is called is completed, the remainder of the original batch file is completed. Note if the batch file does not exist it will give an error message.

CHOICESee running different programs for an example of how to use this command.
  • Additional information and the syntax of this command in each version of Windows and MS-DOS can be found on our CHOICE command page.

CLSJust like the DOS command would clear your screen.
  • Additional information and the syntax of this command in each version of Windows and MS-DOS can be found on our CLS command page.

ECHOWill echo a message in the batch file. Such as ECHO Hello World will print Hello World on the screen when executed. However, without @ECHO OFF at the beginning of the batch file you'll also get "ECHO Hello World" and "Hello World." Finally, if you'd just like to create a blank line, type ECHO. adding the period at the end creates an empty line.

EXITExits out of the DOS window if the batch file is running from Windows.
  • Additional information and the syntax of this command in each version of Windows and MS-DOS can be found on our EXIT command page.

GOTO LABELUsed to go to a certain label, such as LABEL. An example of GOTO would be to GOTO END. For an example of this see running different programs.
  • Additional information and the syntax of this command in each version of Windows and MS-DOS can be found on our GOTO command page.

IFUsed to check for a certain condition if the condition exists. If that condition exists it will perform that function. To see an example of this see running different programs.

  • Additional information and the syntax of this command in each version of Windows and MS-DOS can be found on our IF command page.

PAUSEPrompt the user to press any key to continue.

REMOne of two ways of adding remarks into the batch file without displaying or executing that line when the batch file is run.

SHIFTChanges the position of replaceable parameters in a batch program.
  • Additional information and the syntax of this command in each version of Windows and MS-DOS can be found on our SHIFT command page.

STARTUsed for Windows 95, Windows 98, and Windows NT 4.0 and above to start a windows application; such as START C:\WINDOW\CALC would run the Windows Calculator. Users running Windows 3.x need to utilize the WIN command. For example, WIN C:\Windows\CALC.EXE would run Windows and then Calculator after Windows has finished loading.

kb2003 - How to make a time log in a batch file (SDK)

The below example demonstrates how to create a time log of when the batch file is loaded, or for example, this could be used in the autoexec.bat when someone logs into a computer that supports this file.

ECHO. |TIME > TIME
COPY LOG +TIME


An alternate, slightly more complicated method that, to our knowledge, cannot be used in Windows NT, Windows 2000 or Windows ME would be the following:


echo @prompt set date=$d$_set time=$t$h$h$h > {a}.bat
%comspec% /e:2048 /c {a}.bat > {b}.bat
for %%v in ({b}.bat del) do call %%v {?}.bat
echo %date% %time% >> log


Another alternative is:


echo. |time |find "current" >> log


For the above batch file to work properly you must create a file called log, by typing edit log and then save and exit the file, creating a 0 bytes file. If this file is not created or not created properly you will receive the error message Content of destination lost before copy.

kb2102 - Creating a batch file delay (SDK)

Below is an example of how to delay a batch file any where from 5 to 99 seconds. In the below example we illustrate a 5 second delay.

TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL


Additionally, you could use the sleep file found on Computerhope utility download section.

kb2101 - Start Windows files and other programs from a batch file (SDK)

To run Microsoft Windows programs or files use the START command. The below example would run Windows Notepad.

START /MAX NOTEPAD


You can also specify the direct location of the file by typing the below command.

START /MAX C:\Windows\NOTEPAD.EXE


*Windows users who have a different directory (e.g. Windows 2000 users) would need to substitute WINNT or the name of their directory in place of Windows in the above example.

The /m representing it to start the window Maximized.

kb2100 - Running different programs (SDK)

Below is a simple example of how you can implement the choice options into your batch files. Each line that is in red can be left out of the batch file.

They have been included to help explain some of what the batch file means. Windows 2000 and Windows XP users will need to substitute the choice command with the set command; see our set command page for additional help and information with this command.

@ECHO OFF
REM - LABEL INDICATING THE BEGINNING OF THE DOCUMENT.
:BEGIN
CLS
REM - THE BELOW LINE GIVES THE USER 3 CHOICES (DEFINED AFTER /C:)
CHOICE /N /C:123 PICK A NUMBER (1, 2, or 3)%1
REM - THE NEXT THREE LINES ARE DIRECTING USER DEPENDING UPON INPUT
IF ERRORLEVEL ==3 GOTO THREE
IF ERRORLEVEL ==2 GOTO TWO
IF ERRORLEVEL ==1 GOTO ONE
GOTO END
:THREE
ECHO YOU HAVE PRESSED THREE
GOTO END
:TWO
ECHO YOU HAVE PRESSED TWO
GOTO END
:ONE
ECHO YOU HAVE PRESSED ONE
:END

kb2002 - An example of DOS batch file (SDK)

This article contains downloadable template

Get user input from batch file


Sure, you've done it, but can you do it without having to hit a Ctrl-Z, without ANSI, without a debug script, and without a separate "set" file?



Get user input and mask passwords with HTML


HTML forms can mask passwords as you enter them, so use forms! Here I show you how to have your batch file create a username/password form, then use Windows Scripting to read the contents of that form and transfer the results back into a batch file. As shown, it uses the environment, so you may need to modify things if your target computers don't have room.



Get user input and mask password with HTA


HTML Applications (HTA files) can do everything ordinary HTML can, but there is no need to separate the HTML from the scripting in order to save the results to the hard drive. Like the above HTML method, this creates a batch file named "userin.bat" in the "temp" directory which can be called by your batch file to retrieve the data.



Mask passwords with QBASIC


QBASIC allows you to grab user input without echoing it to the screen. This makes it easy to throw an asterisk up for every character that gets entered. Again, this code stores the password in the environment for your batch file to use. FYI, Win9x boxes don't come with QBASIC installed by default. See here for how to get QBASIC and here for how to install it automatically.



Get user input from an NT batch file


All the old tricks fail. Luckily, QBASIC can be used and is standard equipment in NT. Windows Scripting works better if you have it.



Accept arguments in any order


Simon Richardson shows how to use structured batch programming (as best as batch can do it) to collect arguments. Then I show how to break that structure.


Accept arguments in any order


Fred Fisher said he could improve on the above method to collect arguments. I think you'll agree he did! He does it with a few more IFs and a lot less GOTOs. He demonstrates three separate argument types. One is a switch, another takes one argument, and the last takes two separate arguments. You can easily simplify (or extend) the code for any number of arguments each taking any number of parameters.



How to get around the "Do you really want to do this?" prompt.


Have your batch file send the desired answer..



How to simulate typing to any program.


Send your program keystrokes whether it is a DOS or Windows program. This isn't "User Input", but is more along the lines of simulating a user who isn't there. Great for automating programs that weren't designed to be automated.



kb2001 - Creating a DOS Batch (SDK)

for MS-DOS users

To create a basic batch file in MS-DOS, follow the below steps that give you an example of how to create a basic batch file.

1. Open an MS-DOS command window or get to MS-DOS. Additional information about doing this can be found on document CHDOS.
2. At the MS-DOS prompt, type: edit test.bat and press enter.
3. If typed properly, you should now be in a blue screen. Within the screen, type:

pause
dir c:\windows
dir c:\windows\system

4. Once the above three lines have been typed in, click File and choose exit; when prompted to save, click "Yes." Users who do not have a mouse cursor can accomplish this same task by pressing ALT+F to access the file menu, then pressing "X" to exit, and pressing enter to save changes.
5. Once you are back at the MS-DOS prompt, type: test and press enter. This will execute the test.bat file and begin running the file. Because the first line is pause, you will first be prompted to press a key. Once you press a key the batch file will run line-by-line; in this case, listing the files in the windows and windows\system directories.

If you wish to add more lines to this batch file you would simply type "edit test.bat" to edit the file again.

Additional information about the MS-DOS edit command can be found on our edit command page. Some versions of MS-DOS and bootable diskettes may not have the edit command; if this is the case, you would either need to obtain the edit.com file to access this file or use the copy con command.

for Microsoft Windows and other users

A Windows user can still use the above MS-DOS steps if they wish to create a batch file. If, however, you're more comfortable using Microsoft Windows or your operating system, you can use any text editor, such as Notepad or Wordpad, to create your batch files, as long as the file extension ends with .bat. In the below example we use the Windows notepad to create a batch file.

1. Click Start
2. Click Run
3. Type: notepad and press enter.
4. Once notepad is open, type the below lines in the file or copy and paste the below lines into notepad.

@echo off
echo Hello this is a test batch file
pause
dir c:\windows

5. Click File and click Save; browse to where you want to save the file. For the file name, type "test.bat", and if your version of Windows has a "Save as type" option, choose "All files", otherwise it will save as a text file. Once all of this has been done click the Save button and exit notepad.
6. Now, to run the batch file, simply double-click or run the file like any other program. Once the batch file has completed running it will close the window automatically.

kb1000 - What is DOS Batch?

Batch files allow MS-DOS and Microsoft Windows users to create a lists of commands to run in sequence once the batch file has been executed. For example, a batch file could be used to run frequently run commands, deleting a series of files, moving files, etc. A simple batch file does not require any special programming skills and can be done by users who have a basic understanding of MS-DOS commands.

A good example of a batch file for someone who is more familiar with Windows or the MacOS is to think of a batch file as a shortcut in Windows or an icon on the MacOS. Much like a shortcut, batch files could be used to run one or more commands and/or programs through the command line.

Another example of a very well known batch file is the autoexec.bat, which is a simple boot file loaded each time the computer is loaded on MS-DOS and early Windows computers. This batch file contained all the necessary commands and programs used to run MS-DOS and Windows each time the computer booted.

Download Games

Games that is ported to SkyFireOS is mainly licensed and shareware. Support the contributor / creators by buying original or full version of the games.

Download Duke Nuke' Em for SkyFireOS

Aliens have landed in futuristic Los Angeles, and it's up to Duke to bring the pain and show them the door. It's time to start kicking ass and chewing gum - and he's all out of gum!

Featuring network play and high-res support, Duke Nukem proved popular for years, spawning several add-ons (both licensed and unlicensed).

Download Now ( Mirror 1 | Mirror 2 -10.5 MB ) - Website


Download Command and Conquer for SkyFireOS

It's a classic real-time strategy game. There exist two parties, NOD and GDI. Both have different units and structures. The game features about 15 missions on each side. In most missions you have to build a base first to build new units and structures.

Special harvesters collect the so-called 'tiberium' and convert it to money in a refinery. The game features full motion video after every mission.



Download Hospital Theme for SkyFireOS

Theme Hospital is a level-based hospital management simulation where players have to start on an empty building, and then assemble rooms with all kinds of material, from desks and file cabinets for the general diagnosis to the expensive ultra-scanners and x-rays to diagnose such bizarre diseases such as Bloaty Head, Slack Songue or Alien DNA, and treat them with with even more bizarre machines like an Head Inflator or a DNA fixer.


Download Checkers for SkyFireOS

A translation of classic checkers. You jump over the opponent's buttons, and the last one standing wins. This game doesn't posses the option of playing against the computer, only player vs. player (unless you register to get the full version).


Download Megaman-X for SkyFireOS

Mega Man X is a robot designed by Dr. Light to choose his own path in life. Years after he is created, Dr. Cain finds X and mimics his design to create a race of such robots called reploids. When the sigma virus infects these reploids, causing them to commit acts of evil, it is up to Mega Man X and his partner Zero (who is quite powerful, contrary to what his name implies) to stop it.


Download Street Fighters 2 for SkyFireOS

The original Street Fighter II is a famous fighting game. Players select from one of eight characters: Ryu, Ken, Blanka, E. Honda, Zangief, Chun Li, Guile and Dhalsim to do battle with. They must then use their combat strengths to defeat the other seven fighters followed by four boss characters: M. Bison, Vega, Sagat and Balrog. Each character represents a certain country and has their own reasons for wanting to win against the others.