我正在尝试运行powershell命令,我知道powershell命令工作正常,但是当我尝试使用innoscript运行它时,它打开powerscript并显示命令,但似乎没有运行它。
我基本上是在尝试更改MySql配置文本文件中的文本。
这是我的代码
Filename: powershell.exe; Parameters: "-NoExit {{(Get-Content \""{code:GetConfigPath}\my.ini\"") | ForEach-Object {{ $_ -replace \""max_connections=[0-9]+$\"", \""max_connections=10000\"" } | Set-Content \""{code:GetConfigPath}\my.ini\""}"; StatusMsg: CHANGING MAX CONNECTIONS; Description: CHANGING MAX CONNECTIONS; Flags: runascurrentuser
如果我使用ShellExec标志,则表示PSReadLine不可用
答案 0 :(得分:1)
当我直接执行命令时,我得到相同的结果。所以你的问题与Inno Setup无关。
要使命令正常工作,只需删除最外面的括号。
Filename: powershell.exe; Parameters: "-NoExit (Get-Content \""{code:GetConfigPath}\my.ini\"") | ForEach-Object {{ $_ -replace \""max_connections=[0-9]+$\"", \""max_connections=10000\"" } | Set-Content \""{code:GetConfigPath}\my.ini\"""; StatusMsg: CHANGING MAX CONNECTIONS; Description: CHANGING MAX CONNECTIONS; Flags: runascurrentuser