Share via

How do I rename a directory using command prompt

Anonymous
2016-05-01T03:15:02+00:00

How can I rename a directory using command prompt?  Say I want change c:\Users\User Name\Documents to c:\users\user name\My Documents.  How do I do this?

I looked it up in Google.  Here's what I found.

G:\data>mkdir dir1
G:\data>dir /b
dir1
G:\data>rename dir1 dir2
G:\data>dir /b
dir2
G:\data>What would I write for the data? And what would I write for b?C:\docs>ren c:\docs\1.txt 2.txt
C:\docs>dir /b
2.txtPlease give me an example.Rod Computer
Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
  1. Anonymous
    2016-05-04T19:34:52+00:00

    OK, I fixed it.  What I did was go to safe mode, go to documents, right click the file, go to properties,  Security, Advanced, Owner, and change the owner.  And that's it.

    They don't call me Rod Computer for nothing!

    Thanks

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. LemP 74,925 Reputation points Volunteer Moderator
    2016-05-01T23:20:14+00:00

    I don't know what you might have done when you reinstalled Windows and your files, why files "did not go where they were supposed to go," or where your files actually went.

    Does this problem only occur with Excel files?  That is, if you go to My Documents and double-click on a *.doc file, does it open properly in Word?

    What version of Excel do you have?

    Did the error message you posted happen when you attempted to open the file from the list of recent files in Excel or when you double-clicked the file in Windows Explorer?

    Starting in Vista, Microsoft dropped the "My" from the various special folders such as "My Documents."  Because so many people were used to "My Documents," Microsoft retained that name in the way that the graphical user interface -- in this case, Windows Explorer -- shows the folders.  That is, when you look in Windows Explorer, you see a folder that appears to be named "My Documents."  In fact, the actual folder on the hard drive is named "Documents."

    This is further confused by the concept of "Libraries" that was introduced in Windows 7.  Microsoft explains it this way:

    A folder is simply a container for storing files—nothing more and nothing less. ALibrary doesn’t contain files. Rather, a Library provides a single aggregated view of multiple folders and their contents.

    Adding folder locations to a Library does not duplicate or copy those files or folders in any way. The Library stores only the file or folder location. You can access your files through the Library or by opening them directly in Windows Explorer.

    Windows 7 has four default Libraries: Documents, Music, Pictures, and Videos. Each default Library contains two folder locations: one in the user’s profile folder and the other in the Public profile folder (My Music and Public Music, for example).

    Open Windows Explorer and click the arrow next to "Documents" to expand it.  How many locations are included in your "Documents" library and what are they named?  The usual default is for the "Documents library" to include "My Documents" and "Public Documents" as shown below.  Of course, the actual folders on the hard drive are not named "My Documents" and "Public Documents" -- they are C:\Users<username>\Documents and C:\Users\Public\Documents which you can see if you open a Command Prompt and use the DIR command (see the output from two DIR commands below the screenshot).

    C:\Users\LEMP>dir

     Volume in drive C has no label.

     Volume Serial Number is 6829-85DB

     Directory of d:\Users\LEMP

    04/21/2016  03:12 PM    <DIR>          .

    04/21/2016  03:12 PM    <DIR>          ..

    04/29/2016  09:19 AM    <DIR>          Contacts

    05/01/2016  06:14 PM    <DIR>          Desktop

    05/01/2016  05:38 PM    <DIR>          Documents

    04/29/2016  12:15 PM    <DIR>          Downloads

    C:\Users\PUBLIC>dir

     Volume in drive C has no label.

     Volume Serial Number is 6829-85DB

     Directory of C:\Users\Public

    06/13/2012  01:28 PM    <DIR>          .

    06/13/2012  01:28 PM    <DIR>          ..

    09/18/2014  09:19 AM    <DIR>          Documents

    05/31/2012  12:16 PM    <DIR>          Downloads

    05/31/2012  12:16 PM    <DIR>          Music

    05/31/2012  12:16 PM    <DIR>          Pictures

    ***********************************************************************************************************

    Open Windows Explorer, right-click on that same Excel file named in your error message above, and select Properties.

    Take a screenshot and post it.  You can mask out your user name if you want:

    0 comments No comments
  2. Anonymous
    2016-05-01T16:40:58+00:00

    It does make sense not to rename the directory.   I believe when I reinstalled my windows and restored my files, Files did not go where they were suppose to go. Also when I try to open a file in excel I get this error:

    When I move the file to Desktop it opens just fine. I go to Documents and the file is there but windows can't find the file when I try to open it from excel. Even if double click the file from the folder Documents, I still get this error.

    Rod  Computer

    0 comments No comments
  3. LemP 74,925 Reputation points Volunteer Moderator
    2016-05-01T03:40:51+00:00

    It would be a bad idea to change C:\Users&lt;username>\Documents to C:\Users\username\My Documents because those names are used by the system and many of your installed programs (and Windows already knows that "My Documents" is an alias for "Documents" anyway).

    However, if you wanted to do it (and if Windows let you do it -- something I'm not going to check), you would do it this way (assume your user name is Rod)

    C:\Users\Rod>

    ren Documents "My Documents"

    That is, you don't do anything for "data" (which in my example is Users\Rod).

    You can use the /b or not, whatever you like.  When you use the /b switch in a dir command, you just get a list of the names of the files and folders without any of the date/time or other information.

    For example:

    C:\Users\LEMP>dir

     Volume in drive C has no label.

     Volume Serial Number is 6829-85DB

     Directory of d:\Users\LEMP

    06/20/2012  08:23 PM    <DIR>          .

    06/20/2012  08:23 PM    <DIR>          ..

    06/20/2012  07:37 PM    <DIR>          Contacts

    06/20/2012  07:37 PM    <DIR>          Desktop

    06/20/2012  07:37 PM    <DIR>          Documents

    06/20/2012  07:37 PM    <DIR>          Downloads

    06/20/2012  07:37 PM    <DIR>          Favorites

    06/20/2012  07:37 PM    <DIR>          Links

    06/20/2012  07:37 PM    <DIR>          Music

    06/20/2012  07:37 PM    <DIR>          Pictures

    06/20/2012  07:37 PM    <DIR>          Saved Games

    06/20/2012  07:37 PM    <DIR>          Searches

    06/20/2012  07:37 PM    <DIR>          Videos

    06/20/2012  07:37 PM    <DIR>          Virtual Machines

                   0 File(s)              0 bytes

                  14 Dir(s)  305,598,238,720 bytes free

    C:\Users\LEMP>dir /b

    Contacts

    Desktop

    Documents

    Downloads

    Favorites

    Links

    Music

    Pictures

    Saved Games

    Searches

    Videos

    Virtual Machines

    0 comments No comments