Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$ENV:CMDER_START has a double quote too much #1079

Closed
Kurdym opened this issue Aug 22, 2016 · 18 comments
Closed

$ENV:CMDER_START has a double quote too much #1079

Kurdym opened this issue Aug 22, 2016 · 18 comments

Comments

@Kurdym
Copy link

Kurdym commented Aug 22, 2016

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.

@Kurdym Kurdym changed the title $ENV:CMDER_START has a double quote to much $ENV:CMDER_START has a double quote too much Aug 22, 2016
@Stanzilla
Copy link
Member

@Jackbennett

@Kurdym
Copy link
Author

Kurdym commented Sep 2, 2016

Is there progress?
Can I provide more information?

@Jackbennett
Copy link
Contributor

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"

@Kurdym
Copy link
Author

Kurdym commented Oct 20, 2016

λ 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

@Jackbennett
Copy link
Contributor

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 ?

@Kurdym
Copy link
Author

Kurdym commented Oct 20, 2016

λ $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.

@Jackbennett
Copy link
Contributor

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

@Kurdym
Copy link
Author

Kurdym commented Oct 20, 2016

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   
---------------------------

@Jackbennett
Copy link
Contributor

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

@Kurdym
Copy link
Author

Kurdym commented Oct 20, 2016

No luck: didn't work either.

@Jackbennett
Copy link
Contributor

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?

@MartiUK
Copy link
Member

MartiUK commented Oct 21, 2016

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

@Kurdym
Copy link
Author

Kurdym commented Oct 21, 2016

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

@MartiUK
Copy link
Member

MartiUK commented Oct 21, 2016

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

@Kurdym
Copy link
Author

Kurdym commented Oct 22, 2016

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.

@Jackbennett
Copy link
Contributor

Jackbennett commented Nov 1, 2016

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

@Kurdym
Copy link
Author

Kurdym commented Nov 1, 2016

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.

@Ultraman95
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants