LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   How to change directories in DOS (https://www.linuxquestions.org/questions/general-10/how-to-change-directories-in-dos-129469/)

zWaR 12-28-2003 06:13 AM

How to change directories in DOS
 
Hello, i know it is dangerous to ask such questions on a Linux forum, but i need help and i'm sure here is the right address to get it, besides DOS was not MS invention! :)

How to change directories in DOS, if the names of directories contain spaces, e.g.: my documents; cd my documents doesn't work. I've tried using commands using backslashes, brackets, slashes, cornered brackets, {},<>, quotation marks nothing works. Has somebody any idea how to fix the problem?

XavierP 12-28-2003 06:21 AM

Try:

cd "my documents" or whatever the dir is. If you need to move several directories, try:

cd "my documents\games\Gamefolder with spaces"

quietguy47 12-28-2003 06:23 AM

This might help.
http://www.computerhope.com/msdos.htm#02

aaa 12-29-2003 04:04 PM

Try 'cd "My Documents" ' or 'cd [whatever the dos truncated form is]'. 'Dir' shows the truncated form along with the long one.

Chu 12-29-2003 04:08 PM

Wow, you have all been suffering too much exposeur to Linux :)
I believe he's looking for "cd My Docum~/games/ Games with~/" or something similar, there is a character limit that is valid in DOS, I'm not sure what it is though.

slakmagik 12-29-2003 04:25 PM

Exactly - DOS doesn't allow spaces in names. DOS is limited to 8.3 and, when converting from windows, collapses and capitalizes the first 6 characters, adds a '~1' or what have you (to prevent clobbering), and truncates extensions to 3. (The capitalization isn't important, as DOS isn't case-sensitive but just to explain the display - everything in DOS is caps to DOS.) So

C:\My Documents\cool.game

becomes

C:\MYDOCU~1\COOL.GAM

and that's what you type. In Windows in a DOS box (DOS 7x or the NT emulation or whatever it is), you can use that or the quotes, as XavierP said, or even blackslash escapes, I think.

titanium_geek 12-30-2003 01:46 PM

to change from one drive to the other, you don't need cd.
just type (example)
C:\>D:

titanium_geek

zWaR 01-01-2004 04:13 PM

thank you guys, but nothing worked. let's say i the name of my direcotry is a b (a space b). how to change it from c:\? nothing worked -> that with my documents works on folder name my documents, but im this case (folder a b) not.

XavierP 01-01-2004 04:21 PM

If the folder is in c: (ie C:\a b) then you should type: cd "a b" assuming you are in the root of c.

If you are in My Documents and need to get to c:\a b then you should type in "cd .." (w/o the quotes) until you get back to c:, then do cd "a b".

In Windows you have to be 'above' the folder you need to be able to get to it. Or type in the full path: cd c:\foldername\foldername\foldername\a b.

unimaginative 01-02-2004 10:47 AM

omg!
 
<sarcasm> you damn well careful mister! how could you invoke the name of M$ omg!111111111!11111111!!!!!!!!!!!!!!!!!!!!!!11. Invoking the name of M$ is racist, bigotted, and xenophobic!!! You have to burn everything from m$ to be a true 1337 linux user. Down with the eveil empire1111111!!!!!!!!!1111111!!!!!!!!!!!!!!!!!!!<sarcasm>
p.s. if you want to be a mindless 1337 sheep in the linux flock, always always spell Microsoft with a dollar sign

XavierP 01-02-2004 10:49 AM

We may invoke the Name of the Beast (of Redmond). Surely we all have l33t circles of divine protection?

In the name of Torvalds and of Stallman and of Cox, amen.

:D

unimaginative 01-02-2004 10:50 AM

beast of redmond, lol

unimaginative 01-02-2004 02:48 PM

there are a couple of special cases
first of all, you could use the command chdir instead of cd, but it is pointless extra typing
if you are using win9x there is likely to be a tilde and a number next to the name eg.
C:\progra~1 = C:\Program Files
enter the command "dir" to see what the name is
secondly, if you are changing directories in to a directory that has a space you could type
C:\"Program Files"
or
C:\Program/ Files
You can also just type A: B: C: D: E: or F: as mentioned above to switch to a device
in dos you do not have to omit the space between commands e.g.
cd..
will work the same as
cd ..
keep in mind that directories in dos are backspaces

Cruxus 01-02-2004 05:56 PM

Yes, CD is just a shortened form of CHDIR in DOS and Windows. Anyway, if you want to get to the folder "C:\a b", then you can just type:

CD "C:\a b"

Keep in mind that COMMAND.COM and CMD.EXE are usually smart enough not even to need to escape the spaces or put them in quotes, at least under Windows. However, if you're using Windows 95 or Windows 98, you probably will need to put the directory name in quotes if it doesn't follow the 8.3 format if you're in MS-DOS mode (not just an MS-DOS prompt in Windows).

If you've booted into MS-DOS 6.22 or older and you're accessing a partition with extended filenames (VFAT), you'll have to follow the C:\PROGRA~1 instead of "C:\Program Files" convention.

By the way, using VFAT and NTFS under Linux is similar:

cd "/winmnt/Documents and Settings/User/My Documents"

where /winmnt is where the VFAT or NTFS partition is mounted in the Linux filesystem.

kyvahe 01-02-2004 06:56 PM

Are you using a DOS prompt in windows, or are you using "the real DOS" (No Windows installed)

If your at a DOS prompt under a windows intallition, what version of windows is it? XP, 98, 95


All times are GMT -5. The time now is 02:33 PM.