0
Completed

Add option to start powershell as second option to the "Open in Terminal" on Windows

Pavlo Yalandin 8 months ago updated by Thomas Singer 7 months ago 10

Would be nice to have that on Windows (Linux should be supported as well, but not really needed, I guess).

Cmd is old and not convenient anymore for the commands to run.

I have tried several approaches to add it the same way as cmd, but the window with terminal simply won't show up.

GOOD, I'M SATISFIED

Thank you very much for this. You have improved the timings needed for my daily tasks a lot.

Satisfaction mark by Pavlo Yalandin 7 months ago

Maybe you don't know, but you can add your own tools in the preferences.

Yes, I know that. 

However, there is "some logic?" behind how SmartGit starts a new shell process. While it works with cmd, it does not work with Power Shell.

I have tried to add a new entry to the tools to start PowerShell and it did not work. (PowerShell window does not show up and terminates immediately, while the same command line works fine from "Run" window).

What exact command did you try?

The first approach was

  • command: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.3.6.0_x64__8wekyb3d8bbwe\pwsh.exe
    Arguments: -WorkingDirectory ${filePath}

After I tried different variations with cmd.exe using various /c, /k, start, and call variants, those failed to pass parameters correctly to the power shell, like the working directory.

Note that I use PowerShell installed from the Windows Store. But the same issue with the build-in version. But the parameters to set the working directory are different

Cool, Thank you very much

That worked for me with a built-in version of PowerShell, However when I try to use the same way the new one (Installed from store), it fails. 

Maybe due to the double quotes used to escape the space character in the path.

Could you advise how to escape the space character in the Argument field in the Tool window?

The arguments

/c start powershell.exe -noexit -command Set-Location -literalPath '${filePath}'

should do that.

It did not work. What i am trying to escape is the space character in the path to the executable

The Tool window with the parameters

Image 785

The error is

Image 786

The command line that I used to test your approach with the new PowerShell from Run window is below, but it also did not work when i use in SmartGit

cmd.exe /c start C:\"Program Files"\WindowsApps\Microsoft.PowerShell_7.3.6.0_x64__8wekyb3d8bbwe\pwsh.exe -WorkingDirectory C:\Dev\Projects\oss\common

Okay, After I added the path above to the PATH env variable I worked with PowerShell that is installed from the Store.

Still, would be nice if PowerShell is included as an Option of Tools.

Thank you, Thomas, for the support

Completed

implemented in 23.1 RC 1