Annoying error in PowerShell


  1. Posts : 108
    Windows 10
       #1

    Annoying error in PowerShell


    I have a directory E:\Documents\Steve's\New Documents\Tax
    If I navigate to this directory in explorer, and then use the File->Open Windows Powershell mechanism, then Windows PowerShell opens with the error:

    The string is missing the terminator: '. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

    There's nothing wrong with a single quote character in a directory, so this must be an error in Powershell.

    Is that correct?
      My Computer


  2. Posts : 15,486
    Windows10
       #2

    Swifty said:
    I have a directory E:\Documents\Steve's\New Documents\Tax
    If I navigate to this directory in explorer, and then use the File->Open Windows Powershell mechanism, then Windows PowerShell opens with the error:

    The string is missing the terminator: '. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

    There's nothing wrong with a single quote character in a directory, so this must be an error in Powershell.

    Is that correct?
    You need double quotes around filename "E:\Documents\Steve's\New Documents\Tax".


    Annoying error in PowerShell-image.png
      My Computer


  3. Posts : 31,665
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #3

    cereberus said:
    You need double quotes around filename "E:\Documents\Steve's\New Documents\Tax".
    Any idea how to do that when opening Powershell from File Explorer's 'File' tab as the OP is trying to do? Or with the Shift+RightClick context menu?
      My Computers


  4. Posts : 108
    Windows 10
    Thread Starter
       #4

    cereberus said:
    You need double quotes around filename "E:\Documents\Steve's\New Documents\Tax".

    I'm not the one issuing the CD command. I'm using the option inside the "File" entry in Windows Explorer, all done with a couple of mouse clicks...
    Perhaps it's Windows Explorer which needs to punctuate the command it uses to open Pwershell at my directory.

    Try it for yourself:

    1. Open Windows Explorer
    2. Navigate to a directory of your choice
    3. Create a new directory, maybe "cereberus's"
    4. Navigate to this new directory
    5. Click the "File" entry in Explorer's ribbon
    6. Click "Open Windows Powershell"
    7. Marvel at the error message...

      My Computer


  5. Posts : 15,486
    Windows10
       #5

    Swifty said:
    I'm not the one issuing the CD command. I'm using the option inside the "File" entry in Windows Explorer, all done with a couple of mouse clicks...
    Perhaps it's Windows Explorer which needs to punctuate the command it uses to open Pwershell at my directory.

    Try it for yourself:

    1. Open Windows Explorer
    2. Navigate to a directory of your choice
    3. Create a new directory, maybe "cereberus's"
    4. Navigate to this new directory
    5. Click the "File" entry in Explorer's ribbon
    6. Click "Open Windows Powershell"
    7. Marvel at the error message...

    [/COLOR]
    Yeah obviously a silly bug.

    I guess quickest way to avoid typing long names is to

    1) navigate to folder

    2) click on directory icon in name bar

    Annoying error in PowerShell-image.png

    which yields

    Annoying error in PowerShell-image.png
    3) Press ctrl-c to pu on clipboard.

    Then open powershell and type CD " , paste clipboard and type final ".
    Attached Thumbnails Attached Thumbnails Annoying error in PowerShell-image.png  
      My Computer


  6. Posts : 1
    10
       #6

    Solution


    I know this is an old thread but it came up when I searched for my problem so I'll reply in case someone else stumbles across it.

    I had the same problem ... I figured out that it was because the file name had an apostrophe in it. Once that was removed Powershell was able to work properly. Notice the poster also has a file path that contains "Steve's".
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 12:54.
Find Us




Windows 10 Forums