我在 C++ 项目中使用 Visual Studio 2010。我想从我的 C++ 代码中执行 "Set-SmbServerConfiguration –EncryptData $true"
cmdlet。
我尝试使用 system() 但它不起作用。可能是在执行如下命令后卡在 confirm 选项:
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”)来做到这一点?
最佳答案
尝试将 confirm:$false 添加到 powershell
关于c++ - 从 C++ 调用 powershell cmdlet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46360419/