Closed Snaptags closed 3 years ago
ConEmu does't find a file pwsh. I think conemu don't see system path in function You can find system path to a file and manualy execute file with filepath It's works for me
function ele([string]$application = (get-command 'powershell').Path +' -NoLogo')
{
ConEmuc -c $application $args -new_console:a
}
Thanks for helping me with this. Using get-command
fixes the issue.
In case anyone stumbling upon this issue needs a more generic solution:
function sudo([string]$application = 'pwsh')
{
$path = (get-command $application).Path
if ($application -eq "pwsh") {
ConEmuC -c $path -NoLogo $args -new_console:a
} else {
Start-Process $path $args -Verb RunAs
}
}
Then you can use sudo
to get a Admin PowerShell or sudo appname
to run any app as Admin (has to be found in the path)
Versions
ConEmu build: 210206 x64 OS version: Windows 10 x64 Used shell version: PowerShell 7.1.1
Problem description
One of the latest updates broke my alias to open an elevated ConEmu window
Steps to reproduce
ele
and hit \<enter> to execute itActual results
"ConEmuC64 can't create process, ErrCode=2, Command to be executed: pwsh -NoLogo"
Expected results
A new, elevated pwsh session opens. Funny thing: if I execute exactly the same command MANUALLY, it works as expected: