小编Mik*_*enn的帖子

如何让 ConEmu 在启动时执行 powershell 脚本?

我使用以下命令启动新的 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)

powershell conemu

6
推荐指数
1
解决办法
4711
查看次数

标签 统计

conemu ×1

powershell ×1