Using command prompt

Discussion in 'A+' started by Dhughes, Jun 26, 2007.

  1. Dhughes

    Dhughes Byte Poster

    161
    4
    27
    Im must be getting dimmer lol

    Isnt that just changing the directory im in? Im sorry i thought we were talking about when i did the dir > Test1.txt from the Test1 directory is stored the file in the Test1 folder, didnt you say theres a way of getting that Test1.txt file to store in a different folder apart from the current directory?
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  2. Dhughes

    Dhughes Byte Poster

    161
    4
    27
    Poo the bed ive got it!!!! lol



    dir >..\Test2\Test1.txt :biggrin :biggrin
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  3. wizard

    wizard Petabyte Poster

    5,767
    42
    174
    I'd rather use a toilet :D

    Congratulations :D
     
    Certifications: SIA DS Licence
    WIP: A+ 2009
  4. Dhughes

    Dhughes Byte Poster

    161
    4
    27
    Then the >> command is the same princlible but this "adds" the imformation to the text file and not overwites it, Thankyou Mr Harry Sir, i owe you a beer !
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  5. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Yes!:thumbleft

    And spot my 'deliberate' mistake! I'd left off the actual filename for the destination from the path! :tune

    Well done!

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  6. Dhughes

    Dhughes Byte Poster

    161
    4
    27
    actually thought you did that to make me think about it, which im glad happend :@)

    and finally out of the three ... < whats that all about? lol
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  7. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Where > redirects the *output*, < redirects the *input*.

    When at a command prompt the 'output' is the screen, and the 'input' is the keyboard. The '>' redirects to output to a file instead of the screen. So '<' redirects the input from a file rather than the keyboard.

    You might have a program that expects you to type commands at the keyboard. If it was the same set of commands each time you could automate this by having a file with all the commands in it and use the < to redirect the input to save all that typing!

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  8. Dhughes

    Dhughes Byte Poster

    161
    4
    27
    sorry to be a pain but back to the >

    At the moment im copying the contents list of folder Test1 into Folder Test2 both being on my desktop using dir >..\Test2\Test1.txt


    Now if i put a folder Test3 into my documents folder?

    and i want to get the contents list from Test1 folder in Test3

    i can use...

    dir>"C:\Documents and Settings\david\My Documents\Test3\Test1.txt" by using the absolute path name,

    now i can't find which bit to "break off" so i can use dir >.. \relative path name

    or wouldnt there be one as the path changes directorys completely?
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  9. Dhughes

    Dhughes Byte Poster

    161
    4
    27

    Gotcha! :biggrin
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  10. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Remember how I got the relative path - by showing the CD commands to get there? Do the same. Up to the parent then down to Test3.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  11. Dhughes

    Dhughes Byte Poster

    161
    4
    27
    i had thought id dont that but just says system cannot find path,

    the path the the folder is...

    C:\Documents and Settings\david\My Documents\Test3

    so i thought the relative path would be..\My Documents\Test3

    because both paths are the same up until david then they change, so if i was CD down my steps would be

    C:\Documents and Settings\david\Desktop\Test1
    cd..
    C:\Documents and Settings\david\Desktop
    cd..
    C:\Documents and Settings\david

    then to get to my Test3 folder id

    cd My Documents\Test3

    which would bring me to the Test3 directory

    but using ...

    dir >..\My Documents\Test3\Test1.txt

    doesnt work :oops:
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  12. wizard

    wizard Petabyte Poster

    5,767
    42
    174
    try ..\Test3\Test1.txt
     
    Certifications: SIA DS Licence
    WIP: A+ 2009
  13. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Two things here:
    First - you go up *two* directory levels to get to 'david'. You did cd .. twice. You need to show that.
    And second - notice the space in "My Documents"? You need to put quotes round it!

    Like this - dir > "..\..\My Documents\Test3\Test1.txt"

    See how the .. appears twice to show that you went up 2 directories.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  14. Dhughes

    Dhughes Byte Poster

    161
    4
    27
    try ..\Test3\Test1.txt



    still says the same mate system cannot find the path specified


    I changed this post so it followed better mate as i posted this before i saw you other reply
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  15. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Just to make sure - CD to the Test3 directory and cut'n'paste the prompt here. Somewhere the path isn't what you think it is.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  16. Dhughes

    Dhughes Byte Poster

    161
    4
    27
    Yeah this worked mate dir > "..\..\My Documents\Test3\Test1.txt" o i guess if the folders in the same file you not need quotations and just the one \ but if its not in the directory you need quotations then as many ..\ as its altered from the orginal path, like you put wold be how many times you would need to cd.. to get to the common directory
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  17. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    The point of the quotes is to deal with spaces in the path. No other reason. You *could* use quotes all the time, but there is no need to other than to deal with spaces.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  18. Dhughes

    Dhughes Byte Poster

    161
    4
    27
    Ive now understood everything 100%

    Thankyou for your time and patience Mr Harry, your a true gent :@)

    I feel so chuffed lol
     
    Certifications: A+ Essentails, A+ Technician , MCDST
    WIP: MCSE
  19. Mathematix

    Mathematix Megabyte Poster

    969
    35
    74
    You're going to hate me for this, but XP is the precise environment that this works in. I've tested it both at home and work and it does work - give it a go!
     
    Certifications: BSc(Hons) Comp Sci, BCS Award of Merit
    WIP: Not doing certs. Computer geek.
  20. Mathematix

    Mathematix Megabyte Poster

    969
    35
    74
    You know your stuff! ;)
     
    Certifications: BSc(Hons) Comp Sci, BCS Award of Merit
    WIP: Not doing certs. Computer geek.

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.