Windows optimize

Pop Quiz: Windows command line file and folder tools

Do you know the difference between the ftype and assoc commands? Test your knowledge of working with files and folders from the Windows command line.

Answers to our TR Dojo pop quiz on working with files and folder from the Windows command line (correct answers in bold):

1. Which of the following commands is used to change the command prompt path to a different location?

md

go

change

cd

2. Which of the following commands would create a directory called files at the root of the c:\ drive?

create c:\root\files

md c:\root\files

newdir \files

md \files

3. Which of the following commands would create a directory called new files at the root of the c:\ drive?

create \new files

newdir c:\root\new files

md \new files

md \"new files"

4. Which of the following commands would delete the directory data, which contains files, from the root of the c:\drive?

delete \data

delete /s \data

rd \data

rd /s \data

5. Which of the following commands would you use to view or modify the file type associated with a specific file extension?

type

ftype

assoc

ext

6. Which of the following commands would you use to view or modify the application that will open a specific file type?

type

ftype

assoc

ext

7. Which of the following commands would you use to view or change a file's attributes?

file

attrib

char

info

8. Which of the following commands would you use to encrypt all the files in the current directory and change the directory attribute to E?

encrypt all

encrypt /e

cipher

cipher /e

9. Which of the following commands would you use to delete all files in the current directory with the .txt extension?

del all txt

del .txt

del *.txt

del txt

10. Which of the following commands would you use to take ownership of a file named data.txt in the current directory?

own data.txt

takeown /f data.txt

takeown data.txt

grab /f data.txt

About

Bill Detwiler is Managing Editor of TechRepublic and Tech Pro Research and the host of Cracking Open, CNET and TechRepublic's popular online show. Prior to joining TechRepublic in 2000, Bill was an IT manager, database administrator, and desktop supp...

19 comments
crcgraphix
crcgraphix

I remember working in RedRealm files on the Linux Red Hat and Debian X-Core Systems ... but I don't remember ever seeing these commands after that. In the Cyg Bash I've seen all of these commands if you start fro scratch. And, you configure the bash shell properly..>

ehula
ehula

takeown /f data.txt 'takeown' is not recognized as an internal or external command, operable program or batch file what did I do wrong?

Michael Jay
Michael Jay

but I think I got them all, except takeown, I usually use the GUI for all these.

Who Am I Really
Who Am I Really

[b]CD[/b] = Change Directory [b]MD[/b] = Make Directory [b]RD[/b] = Remove Directory and it's not: [b]CF MF RF[/b] - Change Folder - Make Folder - Remove Folder and in the details mode in windows exploder the default column width for [b]Type[/b] is only wide enough to display [b]File F...[/b] so we have people calling Directories Files "it's in my file" um, no "it's in yer Directory" .

NickNielsen
NickNielsen

It's obviously not one of the native commands to either DOS or the Windows command executive...

Sawyer7271
Sawyer7271

Takeown is a resource kit tool... you'll need to download it.

SteveTheBee
SteveTheBee

I'm running Windows XP Pro and I don't have takeown :-(

Spitfire_Sysop
Spitfire_Sysop

from question #9. It is simple enough to choose the valid answer but it's still a typo.

polingj
polingj

Won't "MD \files" create a sub-folder under the current drive, which *might* be C: ?

NickNielsen
NickNielsen

But MD has been around since before MS-DOS 1.0.

seanferd
seanferd

I believe subinacl can accomplish the same ends, though.

pgit
pgit

Hadn't seen that one before myself. Can't see where I'd have much use for it, either. After all, it's been almost 20 years I've lived without it. attrib has been enough for me, in that ultra-rare event admin doesn't have control of a file. I'm surprised a 'new' command would be so lengthy, I would suggest they rename the command "p0wn." :)

MCC Tech
MCC Tech

In the W7 cmd line, new to me too. ------------------ C:\Users\user>takeown/? TAKEOWN [/S system [/U username [/P [password]]]] /F filename [/A] [/R [/D prompt]] Description: This tool allows an administrator to recover access to a file that was denied by re-assigning file ownership.

Bill Detwiler
Bill Detwiler

I've check two Windows 7 machines and both have the takeown command. I haven't been able to find a specific Microsoft reference on which versions of Windows have takeown, but I would guess that Windows XP didn't include it and Vista and 7 do.

Bill Detwiler
Bill Detwiler

Windows XP doesn't come with the takeown tool, but Windows Vista, Windows 7, and Windows Server 2008 do.

willcomp
willcomp

Proper syntax for creating folder in root of c: if prompt is not in c: is md c:\files. Takes care of all eventualities.

oldbaritone
oldbaritone

there are a couple of things you just *can't* do unless you are the owner, even though you are an administrator. You must use takeown or the Security properties tab, and forcibly grab ownership of the file. Until you do, you're just wasting your time. I wasted 6 hours learning about this...

jesfer
jesfer

viable command in my win 7 also