Cmder: $ENV:CMDER_START has a double quote too much

Created on 22 Aug 2016  路  18Comments  路  Source: cmderdev/cmder

starting a powershell shell gives an error:

Set-Location : Illegal characters in path.
At F:\Standalone\_console\cmder\vendor\profile.ps1:90 char:5
+     Set-Location -Path "$ENV:CMDER_START"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (C:\Users\Kurdy":String) [Set-Location], ArgumentException
    + FullyQualifiedErrorId : ItemExistsArgumentError,Microsoft.PowerShell.Commands.SetLocationCommand

Set-Location : Cannot find path 'C:\Users\Kurdy"' because it does not exist.
At F:\Standalone\_console\cmder\vendor\profile.ps1:90 char:5
+     Set-Location -Path "$ENV:CMDER_START"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Kurdy":String) [Set-Location], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

And

位 echo $ENV:CMDER_START
C:\Users\Kurdy"

Starting powershell as Admin goes OK.

PowerShell

Most helpful comment

In profile.ps1 file , Find Set-Location -Path "$ENV:CMDER_START" replace with Set-Location -Path $ENV:CMDER_START.replace("`"","")

All 18 comments

@Jackbennett

Is there progress?
Can I provide more information?

I wonder how that " got there. What is your $env:username and if you ls c:\users what's that folder named?

Finally what the registry path set to for "cmder here" either tell me from regedit or with PS;

  1. New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT Add HKEY Class Root
  2. get-itemproperty "HKCR:\Directory\Shell\Cmder\Command"
  3. get-itemproperty "HKCR:\Directory\Background\Shell\Cmder\Command"
位 echo $env:username
Kurdy
位 ls c:\users

    Directory: C:\users

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       12-10-2016     07:17                Kurdy
d-r---        13-8-2016     10:11                Public

I do use the portable version of Cmder, and always startup from my file manager "Directory Opus" with the /start argument.

位 New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT                                                                                                    

Name           Used (GB)     Free (GB) Provider      Root                                                                                                CurrentLocation 
----           ---------     --------- --------      ----                                                                                                --------------- 
HKCR                                   Registry      HKEY_CLASSES_ROOT 
位 get-itemproperty "HKCR:\Directory\Shell\Cmder\Command"
get-itemproperty : Cannot find path 'HKCR:\Directory\Shell\Cmder\Command' because it does not exist.
At line:1 char:1
+ get-itemproperty "HKCR:\Directory\Shell\Cmder\Command"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKCR:\Directory\Shell\Cmder\Command:String) [Get-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand
位 get-itemproperty "HKCR:\Directory\Background\Shell\Cmder\Command"
get-itemproperty : Cannot find path 'HKCR:\Directory\Background\Shell\Cmder\Command' because it does not exist.
At line:1 char:1
+ get-itemproperty "HKCR:\Directory\Background\Shell\Cmder\Command"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKCR:\Directory...l\Cmder\Command:String) [Get-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

Oh ok, so powershell just does this for you when you open it all the time (in cmder of course). I thought this must be from the "CMDER Here" context menu when your use cmder.exe /register

So I'm looking at the task setting in conemu here, what's your $env:userprofile ?

位 $env:userprofile
C:\Users\Kurdy

For a moment I was afraid it was my msitake, since I added :P:"^<PowerShell^>" at the end,
but I created a new task, copied the string you refered to, replaced all &quot; with " and ran that task.
Same error.

Have you tried leaving them as &quot; though? It might be to get around how conemu might parse that task.

This is what I copy to a new task:

PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''&quot; -new_console:d:&quot;%USERPROFILE%&quot;

And this error I get then:

ConEmu 161009a [64]
---------------------------
Can't create new console, command execution failed (code 267)

The directory name is invalid.



"F:\Standalone\_console\cmder\vendor\conemu-maximus5\ConEmu\ConEmuC64.exe"  /OMITHOOKSWARN /CINMODE=200020 /AID=19724 /GID=23668 /GHWND=0012162A /BW=169 /BH=69 /BZ=2000 "/FN=Lucida Console" /FW=3 /FH=5 /TA=10100007 /HIDE /ROOT PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command &quot;Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''&quot;



Working folder:

"&quot;C:\Users\Kurdy&quot;"



Choose your shell?
---------------------------
Yes   No   
---------------------------

Will you try PowerShell -new_console:d:%USERPROFILE% -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''"; please?

No luck: didn't work either.

Not too sure about this one then, @MartiUK Can the launcher in some way be passing in $ENV:CMDER_START string with an extra quote?

The launcher sets CMDER_START to directory given as a /START argument or the current directory.

Starting by doubleclicking cmder.exe "solves" the problem.
So it must be within /start

If you have created a shortcut, check what you have put after /START

Well, it was with Directory Opus. The command was:

@sync:F:\Standalone\_console\cmder\Cmder.exe /start "{sourcepath}"

After removing the quotes, it was OK.

Are you ok now? Feel free to re-open.

It is workable for me now, but it remains strange the cmd tab had no problems, nor did admin powershell, but the powershell did. So for me you can leave it closed. Thanks for all the help.

In profile.ps1 file , Find Set-Location -Path "$ENV:CMDER_START" replace with Set-Location -Path $ENV:CMDER_START.replace("`"","")

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jenisys picture jenisys  路  3Comments

emesx picture emesx  路  3Comments

zsedcbm picture zsedcbm  路  3Comments

isnullxbh picture isnullxbh  路  3Comments

hyrious picture hyrious  路  3Comments