Command line questions

Discussion in 'A+' started by mikehende, Jun 28, 2006.

  1. Baba O'Riley

    Baba O'Riley Gigabyte Poster

    1,760
    23
    99
    Also, if you are using cmd (as opposed to command) you can dispense with the double quotes in folder names with more than one word.
     
    Certifications: A+, Network+
    WIP: 70-270
  2. mikehende

    mikehende Kilobyte Poster

    265
    0
    19
    So that explains why all of my attempts are not working, thanks.

    I don't bother to use the double quotes, only wished to know how it works, I simply leave the space between the names.
     
  3. ffreeloader

    ffreeloader Terabyte Poster

    3,661
    106
    167
    The cmd prompt in XP doesn't require double quotes to read spaces in the path correctly? That's a major change since 2000 then, and also different from what I remember on Server 2003.

    It's my understanding that all command line systems would see a space as break in the command, and the next character as the beginning of a new command, if the path is not double quoted. I have certainly never been able to use paths that contain spaces without double quoting them.
     
    Certifications: MCSE, MCDBA, CCNA, A+
    WIP: LPIC 1
  4. d-Faktor
    Honorary Member

    d-Faktor R.I.P - gone but never forgotten.

    810
    0
    39
    if you're really lazy, you do this

    Code:
    cd \
    or
    Code:
    cd \t
    but instead of hitting enter immediately, you hit the tab button a couple of times, until it finds the right folder.

    as for the double quotes, you don't need them in recent windows versions, but you still need to know about them for the exams, and for your real life admin job. not all companies are up to date with their windows.
     
  5. mikehende

    mikehende Kilobyte Poster

    265
    0
    19
    That's exactly why I wished to know about it!
     
  6. Baba O'Riley

    Baba O'Riley Gigabyte Poster

    1,760
    23
    99
    Very good point D. PS, loving the new avatar :thumbleft .
     
    Certifications: A+, Network+
    WIP: 70-270
  7. mikehende

    mikehende Kilobyte Poster

    265
    0
    19
    Before I attempt to understand the 2 posts above, let me try to get around this space for backslash issue please. So from what I understand, the space only works when dealing with sub folders and not when changing directories, correct? If so, if I wish to substitute spaces for backslashes when typing a folder sequence, how [using spaces instead of slashes] would you write this?

    C:\music tools\goldwave\goldwave\lame
     
  8. d-Faktor
    Honorary Member

    d-Faktor R.I.P - gone but never forgotten.

    810
    0
    39
    lol. thanks, baba, but i'm afraid it won't last long, because i'm not very satisfied with this one myself. i can't find a decent image of battle of the planets (or gatchaman for all you crazy purists) that i can convert into a avatar. the 100x100 restriction on the avatars here at certforums is too small for most of my needs.

    [​IMG]
     
  9. d-Faktor
    Honorary Member

    d-Faktor R.I.P - gone but never forgotten.

    810
    0
    39
    i don't understand what you mean with using spaces instead of slashes. there is no substitution taking place.

    [edit] in case of c:\music tools, let's say you are in c:\, you just do this:

    Code:
    cd music tools
    cd being the change directory command, followed by a space that you always use when running a command, and then the actual directory.
    and if you're an oldtimer, you do this:

    Code:
    cd "music tools"
    because not all command lines understand the space between music and tools, thinking tools is a parameter to the cd music command.
     
  10. mikehende

    mikehende Kilobyte Poster

    265
    0
    19
    No wonder you don't understand what I wrote when I don't understand myself, I think I am getting mixed up with this. MM writes

    "The CD command allows you use a space instead of a backslash, a convenient shortcut. For example, you could go to the C:\WINDOWS directory from the root directory simply by typing CD WINDOWS at the C prompt. You can use the CD [space] command to move one level at a time"

    This I am not getting?
     
  11. mikehende

    mikehende Kilobyte Poster

    265
    0
    19
    Sorry, did not see your last post before my last post, understood but now what about what MM wrote above concerning "moving up a level"?
     
  12. d-Faktor
    Honorary Member

    d-Faktor R.I.P - gone but never forgotten.

    810
    0
    39
    if you're in c:\music tools\goldwave\goldwave\lame, and you want to go up one level to go to c:\music tools\goldwave\goldwave, you do this:

    Code:
    cd ..
    as for what mm says, maybe it's because you're quoting out of context, but it doesn't make much sense to me.
     
  13. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Now I am at home and have looked up the relevant part of MM I have to say that I think that section misleading to say the least.

    The general rule about commands is that you place a space after the command to separate it from the words that follow.

    However - there are some situations where if the space is left out the command interpreter (cmd.exe or command.com) will still understand what is typed.

    Myself I *always* put the space in - it is a habit formed from long ago, and means I don't have to remember the places where it can be left out!

    MM seems to have used 'cd\' almost throughout - which I think is confusing!

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  14. d-Faktor
    Honorary Member

    d-Faktor R.I.P - gone but never forgotten.

    810
    0
    39
    aha! now that makes sense. that would explain the confusion. indeed, as you say, the interpreter allows some of what is basically incorrect (or illogical) syntax, and as a general rule i would also recommend to always follow a command with a space. good find, harry!
     
  15. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Now that I hadn't known about. I've just tried it and nearly fell of my chair in surprise!

    However I suspect that you still need to use quotes sometimes; for example how would cmd parse:
    Code:
    copy this file that file
    :biggrin

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  16. Baba O'Riley

    Baba O'Riley Gigabyte Poster

    1,760
    23
    99
    Don't hurt yourself Harry! Regarding the copy command you mention, I think that would work as long as you put in file extensions...Just tried it, it doesn't seem to work in that case. I'm not to what extent the "no quotes" works, I'm only aware of it working with the cd command.
     
    Certifications: A+, Network+
    WIP: 70-270
  17. mikehende

    mikehende Kilobyte Poster

    265
    0
    19
    The more I read about this the more confusing it gets, let me try to see if I can get a correct handle on this by separating everything and taking this step by step:

    First let me start by writing a command with a folder and subfolders, I write this folder:

    c:\music tools\goldwave\goldwave\lame

    What do I have to know here? How does spaces or slashes affect this please?
     
  18. Baba O'Riley

    Baba O'Riley Gigabyte Poster

    1,760
    23
    99
    Well for one, that's not a command, it's simply a path. A command would be:

    Code:
    cd c:\music tools\goldwave\goldwave\lame
    for example.

    With most commands, there MUST be a space between the command and any paramters. Not sure else you're looking for with that question.
     
    Certifications: A+, Network+
    WIP: 70-270
  19. mikehende

    mikehende Kilobyte Poster

    265
    0
    19
    Alright, to change directories you have to use the letters CD to give the command to do so, Using XP Home, if I type

    cd\my images

    this works but if I had typed

    cd my images

    this does not work, why?
     
  20. ffreeloader

    ffreeloader Terabyte Poster

    3,661
    106
    167
    To be able to answer this question we would have to know what directory you are currently in. The first is an absolute path, the second a relative path.... That's where the answer most likely lies.
     
    Certifications: MCSE, MCDBA, CCNA, A+
    WIP: LPIC 1

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.