All you ever wanted to know about DOS: Copying, Renaming, Type, and Edit

Today we’re going to talk about Copying, Renaming, Creating Text Files, and displaying what is inside files when using DOS. These tutorials assume that a general knowledge of DOS is already known. The first tutorial and second tutorial are excellent resources when learning DOS.

Diskcopy

Diskcopy is a command that allows us to copy the contents from one floppy disk to another. This can be useful to create backups of the contents on a floppy disk. This can be useful in easily backing up content on a floppy that contains old finical records and other important documents from the golden days of 3.5″ floppy disks.

1
C:\> diskcopy a:

This would make a copy of the disk that is currently in the a: (default floppy) drive. You should not use diskcopy for anything other than floppy drives, however.

dos

Rename or Ren

Rename or Ren allows us to rename files and folders. Let us start by navigating to our directory that we want to test our files in. The default directory for vista and XP will suffice for this example.

1
2
3
4
5
Vista/7
C:\Users\Dennis>mkdir test

XP
C:\Documents and Settings\Dennis>mkdir test

The mkdir command creates a new directory in the current directory that we’re in so no need to put the entire path to the new directory.

The syntax for the ren/rename is a little strange and nothing like any command previously mention before in this series. Be sure the path points to the parent directory (one level above the test directory), otherwise an error will occur. The syntax is the following:

1
2
3
4
ren [drive]\[path]\[current name] [new name]

Example:
ren C:\users\dennis\test test2

dos

To verify the name change actually occurred, use the dir command to view the contents of the directory.

Edit

The edit command is a very basic text editor in DOS. This allows us to type basic .txt files without word wrap, without spell checker, without any configuration whatsoever.

There are two flavors of the edit command. There is the default blue background\white text option and then we can add a switch that makes the window and text the same as the default DOS window (black background and a light-gray text).

edit edit

In order to activate the edit window, all we need to do is simply type “edit”.

1
C:\users\dennis\test> edit

Type a few lines of text and then press file and save as.

edit edit

Once the file is saved (be sure to include the file extension “.txt”), double check to make sure the file was successfully created by using the dir command.

Type

The type command allows us to view any files created using the edit command regardless of file extension. Files encoded with Microsoft Office such as .doc or .docx cannot be viewed using the type command. The syntax of the type command is as follows:

1
2
[Drive:]\[path]\type [filename.file extension]
C:\users\dennis\test>type dosstuff.txt

type

Notice that we are able to view any file extension as long as it was encoded using the edit command in DOS. If we were to view a file encoded in Microsoft Office 2007 it would look like the following:

type

Notice the arbitrary characters that occur when we try to view documents encoded using MS Word. This is because the encoding format is something that DOS cannot read.

All you ever wanted to know about DOS: Making & Deleting Files and Folders

In this tutorial we will be talking about the creation of directories, removal of directories, and deleting files within DOS. When juxtaposed with navigation, this can be a powerful ally when removing viruses, recovering data on a bad hard drive, deleting stubborn files, and accomplishing simple tasks easily and effectively.

Disclaimer: I am not responsible for any mistakes you make while using DOS. These tutorials are merely for information purposes only.

Why?

Often, we might hear the question, “why would you wast time doing this in dos when you can just right-click and make a new folder or hit delete on a keyboard?” DOS is a useful tool to know especially if we’re dealing with data recovery in safe mode, virus removal in safe mode, fixing a problem, or using certain 3rd party utilities like Disk Wipe.

Making Directories

Making directories is a useful tool when weeding out good files from bad, old from new, and organizing files in something like safe mode.

For those that are familiar with unix commands, this will be like an old friend. The command for creating a new directory is md or mkdir, both do the same exact thing in DOS.

Although we need not navigate to the directory in which we wish to put our new directory in, we can do so by using the chdir or cd command as seen in the first tutorial. Navigating to the parent directory where we will create a child directory is usually a good idea so we can easily see if the directory was created successfully.

Choose a Directory
1
2
C:\> cd C:\users\dennis\music
C:\> cd C:\documents and settings\dennis\my documents\my music

The above line is Vista/7 and the below line is XP.

dos

Once we have chosen, we can create our directory in our music folder like the following:

Create the Directory
1
2
mkdir C:\users\dennis\music\test
md C:\documents and settings\dennis\my documents\my music\test

Remember that mkdir and md are both legal when using the command prompt.

This will create the directory called “test” in the drive C:\ with a path to users > music and then it will create the directory.

dos

One common mistake that happens is that some consider the md as a single command and then you type in the name of the directory we want to create. Allow me to demonstrate:

1
2
mkdir C:\ test   //This is wrong
mkdir C:\test   //This is right

The first example has a space between C:\ and “test” and therefore renders the command invalid. If we take a look at a website URL, we’ll see that it is almost identical.

http://www.atomicpages.net/images/stripes.png is pointing to the world wide web address called atomicpages with the TLD of .net to the directory called “images” which contains a file named “stripes.png”.

Ironically, the only difference between a URL and DOS is the type of slash that it uses. A website URL uses a forward slash (/) and DOS uses a backslash (\).

Applying this logic when creating a directory, we can see that it would make sense to merely continue until we reach the directory that will be created.

Deleting Files

Deleting files in DOS is somewhat of a godsend. At times, there are files that you cannot delete regularly using the Windows GUI so we have to resort to DOS to do our bidding for us. This also can be extremely useful when combating a virus in safe mode.

Deletion of files comes in two flavors:

Del Erase
Originally, the DEL command could not have any wildcards in the parameter of the command. So del C:\ *.* /f would not work. ERASE, on the other hand, was specifically created to allow wildcards and also to erase the files.

Do NOT try del C:\ *.* /f or erase C:\ *.* /f unless you want your entire C: drive wiped clean.

There are times when either command is appropriate, however. If a directory or file is being stubborn and the del command is not working, try the erase command instead.

Useful Switches
/p /q /f /a
This prompts before deleting of files. This can be useful if you have to delete a small number of files but don’t want a certain file deleted. Enables “quiet mode” where you are not notified to confirm deletion of any files. Useful for a large number of files. Enables a forceful deletion of files Activates attributes that can help you define which files you want to delete. Use del /? for more details.

To further illustrate the minor difference between del and erase, there once was a time where I had a Windows.old file from a clean install from Vista to 7. For the life of me I could not remove this directory. I tried viewing hidden files and folders, tried using del C:\windows.old /f tried rd C:\windows.old and then I tried the following: erase C:\windows.old /f and then finally I was able to remove the directory.

Using Del and Erase

A good way to practice is to go to lipsum.com and generate however many words, paragraphs, or bytes of words you want to create new .txt documents by right-clicking and selecting new from the menu in Windows. Name them different things and then navigate to our test directory and display the files within the directory via dir.

If we want to delete all of the folders, we would type the following:

1
2
3
4
5
6
C:\> del C:\users\dennis\music\test
C:\> del C:\documents and settings\dennis\my documents\my music\test

C:\> del C:\users\dennis\music\test\*
C:\> del C:\documents and settings\dennis\my documents\my music\test\*
Are you sure (Y/N)?

dos

Notice how DOS automatically puts \* at the end so that all files will be deleted. Erase will work and look the same as del in this situation.

Removing Directories

Removing Directories through DOS will save you heartache in the long run especially if the directory is one you could not delete normally through the Windows GUI.

rd or rmdir is the command we would use to remove a directory. If the directory is not empty we’ll get an error like the following:

dos

Be sure the directory is empty using the erase command and then do the following:

1
2
3
4
5
6
C:\users\dennis\music\test\> ..\ \\brings you up one dir
C:\users\dennis\music\> rd C:\users\dennis\music\test

C:\> del C:\documents and settings\dennis\my documents\my music\test\> ..\ \\brings you up one dir
C:\> del C:\documents and settings\dennis\my documents\my music\>
 rd C:\> del C:\documents and settings\dennis\my documents\my music\test

dos

The ..\ literally brings us up one parent directory or up one level in the file tree.

That’s it! Now you know how to use basic commands that allow you to create folders, delete files, and to remove folders from your hard drive.

All you ever wanted to know about DOS

DOS is an acronym that stands for Disk Operating System and was the base for Windows Operating systems until Windows 2000 when Windows NT took over. When you boil any windows os down you get dos eventually. DOS, cmd.exe, or command prompt — three terms that are not all mutually exclusive — is a very powerful tool when combating viruses, formatting your hard drive, or simply copying files and folder from one directory to another.

Please note: directories are different in XP and those examples will be clearly indicated with a line below the Vista and Windows 7 directories. So if you’re a faithful XP user, your command line is below the divider.

Note: All commands used in this tutorial series work on XP, Vista, and Windows 7.

In this tutorial, we will be going over basic DOS navigation commands. So let us begin already!

C:\> is how we often identify CMD from something like Windows Power Shell or a Unix Terminal.

Power Shell

This is an example of Windows Power Shell explaining foreach loops

Why would we use CMD?

There are a number of reasons why we would use CMD. Often, we use CMD to view network statuses, open Windows Utilities like System Configuration, or to delete stubborn files that we cannot delete normally.

Note: if you are using Vista or Windows 7, you will need to open cmd.exe as an administrator. This is called an elevated cmd where you start in the System32 directory and cmd.exe has full admin privileges.

Navigating Through DOS

Navigating through the command prompt is very easy and powered mostly by one simple command: cd.

cd or chdir stands for Change Directory. This allows us to change directories (or folders) in DOS. For example:

Let us assume we just opened the command prompt and we wish to navigate to the root directory of our C: drive. In order to do this we would do the following:

1
cd C:\

dos

This is telling DOS to change the directory to C:\ or the root directory of the Hard Drive.

Using a bit more complex directories, we can navigate to our music folder from the root directory (C:\>)

1
2
C:\> cd C:\users\dennis\music - VISTA/7
C:\> cd C:\documents and settings\dennis\my documents\my music -XP

dos

Note: when using CMD, the commands and any text you write are NOT cap-sensitive. There is no difference between CHDIR and chdir, they both will work.

If we got lost in here, fret not. This brings us to our next command which is dir which stands for directory. A directory is any really just any old folder on your hard drive. This could be the Windows directory, the System32 directory, or the Music directory.

The dir commands shows us all of the directories and files within the directory we are in. Let us assume we’re back in the root directory of our C: drive and we want to see all files and folders within the C: directory we would simply type:

1
C:\> dir
VISTA / 7 XP
dos dos

We can see that there are many folder within the root directory of our C: drive. The Windows folder contains our operating system, the user folder contains out user accounts and personal files, and the Program Files contains all of our applications.

Switches

If you are familiar with programming then you are familiar with functions (methods for those java programmers). In DOS we have what are called switches. These switches or arguments, allow us to have a command do something specific or only do part of the command. For example,

1
2
3
4
5
dir |more
dir /4
taskkill /im iexplorer.exe /f
erase C:\windows.old /f
rd C:\windows.old /q /s

The forward slash / designates the switch used for the DOS command.

The most important switch of all

By far the most important switch to know is /?. Confused a little? The /? switch allows us to get help with any command. Using this siwtch on a command will show us the syntax, all of the siwtches that can be used, and often it will show examples of the command in use. For example,

1
dir /?

dos

Using this switch, we can figure out all other switches and easily determine what we need to do. If, for instance, we wanted to show the directories and files that end with .sys except, we want them in alphabetical order, we would do the following:

1
dir *.sys /on

This will find all files that end with .sys and place them in alphabetical order. The switch /on can be separated into two components first.

/o /n
Enables the sortorder switch. This allows you to sort the order of the directories you are searching through The subswitch — so to speak — is like an extension of the sortorder switch. Since it’s a subswitch, we can negate the / before the n.

Wildcard

You may have noticed the asterisk before the .sys. This is called a wildcard. If you’ve ever done programming of any kind of are proficient in CSS, then you may have encountered this wildcard before.

Basically, a wildcard is something that allows you to do something or apply something to multiple things without having to define them all directly. This can be important when navigating through DOS. If, for instance, we’re looking for a .exe file but we don’t know the name of it or even if you know part of the name, then we can use the wildcard to find it. COnsider the following:

1
C:\users\{username}\documents\pictures> dir n*.jpg

This will search through the entire picture folder for images that start with n and end in .jpg.

Question Mark Wildcard

The question mark is another form of wildcard with DOS. The difference is the number of character that can be used for each wildcard. The Asterisk (*) will allow up to an eight character substitution and the question mark (?) will allow for a single character substitution. For example,

1
C:\Windows\System32\> dir x*.e?? /on

This would search for any files and directories that begin with “x” and end with the file extension that starts with an “e”. These results would also return alphabetically via the switch “/on” as mentioned before.

Installing Windows XP

Ever since 2001, Windows XP has been a favorite OS by millions of people. Born out of Windows NT and came with multiple flavors of XP, users were charmed with its fresh new look and ease of use.

Note: for VM using Virtual PC 2007 click here to view necessary information for installing Windows XP Professional X86.

Versions:

  • Home Edition
  • Professional
  • Tablet PC
  • Media Center Edition
    • Media Center Edition (Freestyle 2002)
    • Media Center Edition (Harmony 2004)
    • Media Center Edition (EHarmony 2005)
  • Professional X64 Edition

With these many distributions of the OS, people could pick and choose between the features and determine exactly what the need.

Installing Windows XP

Today we’ll be installing Windows XP Professional X86 (32-bit edition) from scratch. Before we install we need to prepare our Hard Disk Drive (HDD) for installing XP.

Step 1

Find your Windows Product Key. If you have lost your product key or are not sure if it is correct then you should download a free product key finder that is compatible with your current installation of Windows XP. http://www.winkeyfinder.com/ this website, however, only applies if you are moving your installation from one computer to another computer.

Create the necessary partitions and/or back up all of the important files that you need for this new installation. If you intend on wiping your HDD then using http://www.diskwipe.org/ software that is available for free is a great tool to wipe an HDD with. You’ll need to mount this progam on a CD and boot from the CD and when it prompts you type the following: WIPE 0

Once you’ve done what you need to do in order to prepare your HDD for installing XP, pop the CD/DVD in and turn off the computer off and back on to boot from the CD/DVD. The first thing you’ll see is the following:

The next thing you’ll see is the beginning of the Windows Installer with a bright blue background:

Once all of the necessary items are loaded for the Installer to commence you’ll see the follwing:

Press Enter to setup XP.

Step 2

The first thing you’ll be asked to do it to accept the EULA or the End-User License Agreement, press F8 to accept the EULA otherwise the OS will NOT install.

Step 3 1

Select the Hard Drive or the HDD Partition that you wish XP to be installed on and then press enter.

Step 4 2

The next step is important to installing your OS. If you don’t want to use the Wipe utility you can do what’s called a high-level format which wipes the HDD.

NTFS Quick v. NTFS

NTFS Quick NTFS
NTFS Quick only wipes out the Master Boot Record (MBR) and the parition tables you have assigned to that drive. The deletion of files, however, does not occur. NTFS normal disk format not only wipes the MBR and the parition table, but is also wipes out ALL of the files that are in the drive. Once this is done it cannot be undone and you will not be able to retrieve any files from the HDD. This is also called a high-level format.

If you used the Wipe utility then you can use the NTFS Quick setting and if you did not but you want to wipe the drive then you can use the NTFS format to wipe the drive.

Select the option you wish to use and then press enter. You will see the following:

Once this is done you’ll see the following:

This portion of the setup is just analyzing your HDD to make sure the format went well and goes by relatively quickly.

Step 5

Once the formatting process is finished and it has checked to make sure everything has gone correctly, you will see this:

This is merely loading all of the necessary files that are needed to begin and complete the XP setup. After it gathers all of the necessary files you will see that the files are being configures and then the system will reboot.

Setting up Windows XP

Now that all of the core files have loaded for the setup to commence, we can actually begin installing and configuring our installation of the OS.

At first, it appears as if the XP installation had finished when, in reality, it’s just the tip of the iceberg unfortunately.

Step 1

Windows will first analyze your system and prompt you which language you are using and how you would like your keyboard setup.

Step 2 3

Next we’ll need to type the name of the PC that we wish to use.

Step 3

Enter in your 25 number product key and then continue. If you are unsure of your product key and you might have lost it then there is the software mentioned at the beginning of this tutorial.

Step 4

Once the product key has successfully been entered we now will configure the admin user and time settings. We have an option from UTC – 12 to UTC + 12. Here in Pacific Time Zone we’re UTC – 8.

Step 5

This is where the fun begins. Be prepared to spend time doing something else while the OS installs. This is really just preparing the OS for installation.

Step 6

For setting up the network, it is advised to setup all of the typical settings (which is basically everything) since it is all you’ll need to have a fully functional computer.

Step 7

Wait. Nothing more, nothing less. The only thing we do now is wait. Here are multiple screen shots of the installers progress:

Finalizing the Install

From what may seem like an eternity, Windows reboots itself this time and we start to configure the OS to our liking before we actually are able to use XP.

Step 1

Automatic Updates are essential for any Windows Operating System. This allows Windows to search and download updates and even install them without you having to approve of such updates. These updates include security patches, OS patches, service packs, updates in key software such as hardware drivers, manufacture software, Microsoft Office, and Internet Explorer updates.

Step 2

Setting up the network is important but not vital. If you are unsure if your PC is on a network or if it directly connects to the internet then select no for the answer and continue with the configuration. You can always change these settings in control panel later on.

Step 3

Activating Windows is an important process to get done with. You will, however, need an internet connection in order to activate windows. If you do not have an active internet connection then you should find some way to activate the OS.

Registering with Microsoft is relatively unimportant. You can choose to register or to not register.

Step 4

This step in configuration allows us to create our admin user and up to four additional users of the computer. XP was the first Operating System that allows multiple users and it passed Apple’s OSX 10.0 initial release codename cheetah with great popularity and more features.

Step 5

Once this is all done you’ll get the following screen:

and then the OS will finish booting and presto!

Virtual Machine Reference Material for Virtual PC 2007
1 The hard drive that we see here will be the amount of space that we allocated to the VM in step 8 of the Microsoft Virtual PC 2007 software. 2 The format of the HDD doesn’t mean anything because there is nothing on the virtual drive. It is completely blank. It has not yet gone through a high-level format like the host computers HDD has. You can select either option. 3 An interesting phenomenon happens here if the names of the host computer and the virtual machine are the same. You must name the VM something other than what the hosts name is. e.g. Host: Dennis-PC and VM: Dennis-PC. This is not allowed.

Creating a Virtual Machine with Microsoft Virtual PC 2007

The first VM tutorial that we read about was with a paid software created by Parallels. If you didn’t read this tutorial and you are interested then click here.

How to Find

This may seem silly to some out there but this little bit of software isn’t easy to find actually. If you use your preferred search engine and simply type Microsoft Virtual PC 2007 you’ll get a link like the following: http://www.microsoft.com/windows/virtual-pc/ this is NOT. Why? Because they also want you to download obnoxious software with it as well.

The URL you really want only has the software you actually need from Microsoft and can be easily found and downloaded here.

Installing Windows XP as a VM

In this tutorial we’ll be installing Windows XP Professional X86 on our VM. This could be helpful if you have software or hardware that is not yet supported on Windows Vista/7 and perhaps might never be supported. You can, of course, install any OS you wish on your PC and run it as the VM.

Step 1

Just press next

Step 2

We need to either create a new Virtual Machine with our own custom settings, create a vm using the typical settings as determined by Microsoft, or add an existing VM.

We want to create a new VM using our own custom settings (the first option).

Step 3

Name the Virtual Machine something that can be easily remembered and lets you identify your VM instantly by the OS it uses. XP or Windows XP will suite for this VM.

As for the physical location of the VM, it will be saved in the following places:

For XP: C:\documents and settings\My Virtual Machines

For Vista and 7: C:\users\{username}\Documents\My Virtual Machines

Step 5

Next we need to set our OS that we are installing.

For this tutorial we’ll be installing Windows XP Professional X86 but we have multiple options that we can choose from.

Step 6

Next we’ll want to set our own custom amount of RAM for the VM to use. This is very contingent on the amount of available RAM you have on your host system. If you are unsure how much RAM you have go to run by pressing windows key+r and typing msinfo32 you are looking for the Installed Physical RAM and the Total RAM. If your total RAM exceeds 1.5GB then you should allocate more RAM to the XP VM. 400MB-512MB for 2GB of RAM is acceptable.

Step 7

Next we want to create a new disk for our VM and then we want to allocate the necessary space for the VM.

Step 8

Now we need to add some less or more space (depending on what we want) to the Virtual Disk which the OS will be installed on. For some strange reason Microsoft uses a default number of 65536MB or 6.55 GB of space for XP to be installed on. I lessened the number to 40000MB or 4GB of space because I’ll just be installing the OS and that’s it. You can always modify the settings for the RAM and HDD space later on once the OS is installed.

Step 9

Once everything is setup the way we want it, press finish and you’ll notice that in the Virtual PC Console our newly created VM is in there.

Step 10

Insert the Windows XP or your OS CD/DVD that you will be installing and when you launch the VM click on the CD option and select boot from CD drive.

Installing Windows XP

See Installing Windows XP at the top there will be a link that explains all of the critical information that you need to know about installing XP on a VM.

Once we’re done installing XP we now can run applications and an OS through the free software available through Microsoft.