我正在将Visual Studio 2010与C++项目一起使用。我想从我的C++代码中执行一个"Set-SmbServerConfiguration –EncryptData $true" cmdlet。

我尝试使用system(),但无法正常工作。执行命令后,可能是卡在确认选项上,如下所示:

Confirm
Are you sure you want to perform this action?
Performing operation 'Modify' on Target 'SMB Server Configuration'.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

有什么方法可以通过Windows中的c++代码使用默认确认值(“Y”)来执行此操作?

最佳答案

尝试将确认:$ false添加到PowerShell

关于c++ - 从C++调用Powershell cmdlet,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46360419/

10-11 22:25
查看更多