Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Help with Command-Line  (Read 10492 times)

0 Members and 1 Guest are viewing this topic.

JL2

    Topic Starter


    Starter

    • Experience: Experienced
    • OS: Windows 10
    Help with Command-Line
    « on: January 24, 2021, 07:21:03 PM »
    Hello,
    new to board.

    I made an error in the way I named a folder on my computer that didn't present itself a problem until recently.

    The folder name structure is:   Name1 & Name2

    Recently while trying to solve another issue, I needed to change to that directory using c:\cd Name1 & Name2  and that ampersand prevented me from accessing the folder because I don't know the syntax to use.

    Would someone be so kind to help me please?

    strollin



      Adviser
    • Thanked: 84
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Guru
    • OS: Windows 10
    Re: Help with Command-Line
    « Reply #1 on: January 25, 2021, 06:12:52 AM »
    Try putting the folder name in quotes like this: cd c:\"name1 & name2"

    JL2

      Topic Starter


      Starter

      • Experience: Experienced
      • OS: Windows 10
      Re: Help with Command-Line
      « Reply #2 on: January 25, 2021, 09:05:17 AM »
      thank you strollin for your reply, however, that did not work.

      I've also tried cd name1""^&""name2

      patio

      • Moderator


      • Genius
      • Maud' Dib
      • Thanked: 1769
        • Yes
      • Experience: Beginner
      • OS: Windows 7
      Re: Help with Command-Line
      « Reply #3 on: January 25, 2021, 11:45:53 AM »
      Rename the folder with no ampersand...
      " Anyone who goes to a psychiatrist should have his head examined. "

      strollin



        Adviser
      • Thanked: 84
        • Yes
      • Certifications: List
      • Computer: Specs
      • Experience: Guru
      • OS: Windows 10
      Re: Help with Command-Line
      « Reply #4 on: January 25, 2021, 11:59:44 AM »
      Renaming the folder as suggested by patio will also work but isn't necessary.  The quotes will work provided you typed the command correctly.  The syntax you attempted: cd name1""^&""name2, will work fine as long as you simply use quotes like: cd name1" & "name2 (don't forget the spaces before and after the ampersand).

      JL2

        Topic Starter


        Starter

        • Experience: Experienced
        • OS: Windows 10
        Re: Help with Command-Line
        « Reply #5 on: January 27, 2021, 10:18:50 AM »
        thanks again for your response but I'm unable to get the result I'm looking for. I have read your instructions carefully.

        I was able to find a solution on another board.

        Make sure to be in the directory where your folder is located. In this case c:\users

        type:  cd name
        press the TAB key
        result: "name & name2"
        press ENTER
        result: c:\Users\name & name2    You are now in the directory

        Thanks again

        strollin



          Adviser
        • Thanked: 84
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Guru
        • OS: Windows 10
        Re: Help with Command-Line
        « Reply #6 on: January 27, 2021, 12:45:43 PM »
        Glad you found a way to do it, the method I posted has worked fine for me for many years.

        Another command that would work: cd c\users\Name1*

        Squashman



          Specialist
        • Thanked: 134
        • Experience: Experienced
        • OS: Other
        Re: Help with Command-Line
        « Reply #7 on: March 26, 2021, 01:28:18 PM »
        Best practice is to quote around the full path for any command you are using with file or folder paths.

        Code: [Select]
        cd "c:\name1 & name2"
        Code: [Select]
        cd "name1 & name2"