我使用以下命令启动新的 ConEmu powershell 控制台。
ConEmu64.exe /config "shell" /dir "c:\" /cmd powershell -new_console:n
Run Code Online (Sandbox Code Playgroud)
我想传递一个额外的参数来指定在新控制台启动时运行的 powershell 脚本。以下几乎可以工作,但只打印整个命令而不实际执行它:
ConEmu64.exe /config "shell" /dir "c:\" /cmd 'powershell -noexit -Command {Write-host "Hello world"}' -new_console:n
Run Code Online (Sandbox Code Playgroud)
它产生:
Write-host Hello world
C:\>
Run Code Online (Sandbox Code Playgroud)
虽然我期待:
Hello world
C:\>
Run Code Online (Sandbox Code Playgroud)