LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 12-28-2003, 06:13 AM   #1
zWaR
Member
 
Registered: Dec 2003
Distribution: Slackware, Alpine Linux, Ubuntu, Debian
Posts: 219

Rep: Reputation: 35
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?
 
Old 12-28-2003, 06:21 AM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Try:

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

cd "my documents\games\Gamefolder with spaces"
 
Old 12-28-2003, 06:23 AM   #3
quietguy47
Member
 
Registered: Mar 2003
Location: Everett
Distribution: Slackware
Posts: 805

Rep: Reputation: 35
This might help.
http://www.computerhope.com/msdos.htm#02
 
Old 12-29-2003, 04:04 PM   #4
aaa
LQ Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 47
Try 'cd "My Documents" ' or 'cd [whatever the dos truncated form is]'. 'Dir' shows the truncated form along with the long one.
 
Old 12-29-2003, 04:08 PM   #5
Chu
Member
 
Registered: Nov 2003
Location: Australia
Distribution: Slackware 9.1
Posts: 166

Rep: Reputation: 30
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.
 
Old 12-29-2003, 04:25 PM   #6
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
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.
 
Old 12-30-2003, 01:46 PM   #7
titanium_geek
Senior Member
 
Registered: May 2002
Location: Horsham Australia
Distribution: elementary os 5.1
Posts: 2,479

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

titanium_geek
 
Old 01-01-2004, 04:13 PM   #8
zWaR
Member
 
Registered: Dec 2003
Distribution: Slackware, Alpine Linux, Ubuntu, Debian
Posts: 219

Original Poster
Rep: Reputation: 35
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.
 
Old 01-01-2004, 04:21 PM   #9
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
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.
 
Old 01-02-2004, 10:47 AM   #10
unimaginative
Member
 
Registered: Aug 2003
Location: USA
Distribution: SuSE 8.2 Professional
Posts: 159

Rep: Reputation: 30
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

Last edited by unimaginative; 01-02-2004 at 10:49 AM.
 
Old 01-02-2004, 10:49 AM   #11
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
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.

 
Old 01-02-2004, 10:50 AM   #12
unimaginative
Member
 
Registered: Aug 2003
Location: USA
Distribution: SuSE 8.2 Professional
Posts: 159

Rep: Reputation: 30
beast of redmond, lol
 
Old 01-02-2004, 02:48 PM   #13
unimaginative
Member
 
Registered: Aug 2003
Location: USA
Distribution: SuSE 8.2 Professional
Posts: 159

Rep: Reputation: 30
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
 
Old 01-02-2004, 05:56 PM   #14
Cruxus
Member
 
Registered: Aug 2003
Location: St. Louis, Missouri
Distribution: Debian 3.0r1 (2.4.18-5 i686)
Posts: 104

Rep: Reputation: 21
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.
 
Old 01-02-2004, 06:56 PM   #15
kyvahe
LQ Newbie
 
Registered: Sep 2003
Posts: 8

Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I change the directory I am currently in and all directories under it to 755? abefroman Programming 6 10-21-2005 06:15 PM
chmod to only change directories lluciano Linux - General 2 08-17-2005 02:14 PM
change DOS name calvin_wang Red Hat 8 03-23-2004 03:20 PM
Where to find/How to change .h include directories for g++ sfcesario Linux - Software 1 01-31-2004 10:12 AM
How do I change permissions of files/directories? Okashira Linux - Newbie 5 01-12-2004 05:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 05:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration