I need a command prompt genius!!!

  • Thread starter R063R
  • 12 comments
  • 2,330 views
292
Northern Ireland
N. Ireland
R063R_GL4560W
Evening all.

I have an external hard drive that I used on my old XP system. A few months ago I got a new system using Windows 7. I have loads of old photos all dumped into the HDD with no organisation whatsoever, so I have a bit of free time to do it today. I need to look through each individual image and put it into a collective folder (also on the HDD), but as I was doing this a dialog box kept appearing telling me I needed admin permission to complete the move. As I am the only user on the system there was the blue and yellow shield in the box so I just clicked enter and that completed the move. But I don't want to do that for every single image I have.

I googled a fix and ended up putting in a command into the command prompt that has stopped me moving anything. I now do not have the slightest clue how to undo what I have just done and I fear the potential loss of my HDD.

The command the answer page said to do was

"4. Type
takeown /F (external drive letter) and press Enter.
5. Type
CACLS (external drive letter) /G Administrator:F and press Enter"

so what I done was type

"takeown /F F:"

then

"cacls F: /G Administrator:F"

It then asked me was I sure, and I typed yes then the next line that appeared was

"processed dir: F:\"

Now I can't move anything around in this HDD although I can still open the folders. System hasn't been rebooted or anything since I put the commands in as I wanted to have a record of it to ask in here. Can anyone help me???






EDIT - I closed the windows that I had opened of the two folders on my HDD to see would that change things and now I can't even access the HDD at all. Where it should show the status bar of used space and free space it now just says "NTFS"
 
Last edited:
Sounds to me like you never had administrator priviledges, so when you did the 'cacls' and handed over full control to the administrator account, you lost the ability to access it from what ever user you were logged in as.

If you are not the admin (go to command prompt and type this: echo %username% to see) then I don't think you wanted to put "administrator" in this statement "cacls F: /G Administrator:F", it should probably have been whatever the result of echo %username% was.

Just a guess...

My computer doesn't understand takeown, but then it is only XP.
 
Last edited:
It has me (Roge) as username. But my user profile is the only profile on the system. Is administrator entirely different from that? Can I replace "Administrator" for "Roge" and type that cacls line again to fix this, or is it somewhat more difficult than that?
 
It has me (Roge) as username. But my user profile is the only profile on the system. Is administrator entirely different from that? Can I replace "Administrator" for "Roge" and type that cacls line again to fix this, or is it somewhat more difficult than that?

I think admin is always there, and will be different to Roge.

If it were me, that's what I'd try... BUT I DO NOT KNOW WHAT THIS WILL DO!!! SO PLEASE, DO THIS AT YOUR OWN RISK!!!

edit: It might not even let you now. Administrator trumps users..
 
Last edited:
Control Panel has Roge as the administrator..... And it is the only account. How can something else be the admin if it's only me that uses it and put all the software on it....?
 
Control Panel has Roge as the administrator..... And it is the only account. How can something else be the admin if it's only me that uses it and put all the software on it....?

Not sure.

Just type:

cacls F:

and see what it says
 
Hmm, well I can't really help. cacls changes user permissions on the file(s), what you've done appears to be to grant full control to a user called administrator.
 
Administrator exists in Windows 7, but is a disabled account, i.e. you can't actually log in as administrator. It does not show up as an account in the basic Control Panel User Administration.

Still, Administrator has all the expected superuser rights and authority on the system, and when you right-click a program and pick "Run as Administrator" instead of just double-clicking the icon, you get more rights during the session.

All of this is just explanation of why Administrator exists but you can't see it.

Now, as to what you've done....

takeown is used to take ownership of a file. I'm not sure it actually did anything here because you didn't specify a file, you specified a drive. I think what you did is take ownership for yourself (since no user was specified in the takeown command) of all files in the root of F: but nothing else. Without the /R the takeown command does not extend to subdirectories. For the most part I think this command was harmless.

The CACLS command is used to change access lists, i.e. permissions to files. What you did was grant Administrator full access to the files in the root of F:. Permissions are inherited down the directory tree, though, unlike ownership, so that access is throughout the drive. Probably.

I think the best thing to do is to get someone onto the computer who understands Windows's permissions settings and tell them to fix it.

The thing about having to confirm that you want to copy the file is part of Windows 7. Depending on the security settings of the target folder, it doesn't have to ask you that every time you copy a file there.

The big lesson here is to not mess with stuff if you're not sure what it's doing; if you don't actually understand what's being changed. Those command-line utilities for this are quite dangerous, even a simple typo can wreak havoc on your system. Imagine if you'd said C: instead of F:.
 
Does "cacls F: /c" work

/c over rides access denied errors... if it works to show you the table it might allow you specify full control rights to Roge ( cacls F: /c /g Roge:f )

..again, just guessin'
 
The "/g" switch in "cacls" grants the specified user access to the files. It's an additive permission, it does not replace permissions on the file.

I think you've broken the permissions with the "takeown" command. It normally grants SYSTEM permissions in the context of the logged-on user.

My recommendation is to launch a new command prompt from the Start Menu. It lives in Accessories, where you should right-click it and choose "Run as Administrator". Then enter

Code:
takeown /u roge /p <your password> /r /f f:

Specifying the username and password explicitly sets the owner's name to you.

What you can also do is get hold of robocopy, which is in the Windows 2003 Resource Kit. You can download this from the Microsoft Download site, and you don't have to have a Windows Server 2003 licence. Copy the files over to your new machine with

Code:
 robocopy f: <destinationfolder> /e /nocopy

"/e" is "copy all directories including empty ones" and "/nocopy" bins all the security info, causing the copied files to inherit the permissions of the destination directory.

Hope that helps.
 
So did he managed?

Because it's easy, make an image of your HDD, format it so it works 100% under win7. Recopy the image. Done.
 
Back