获取server安装的各种组件的powershell命令,可以在server上正常命令行执行powershell -command "& {get-windowsfeature | Out-File -FilePath C:\Command.txt}"但我用C语言写出来的exe去跑的时候总是不能正常执行,因为server环境里面没有debug环境,所以也不知道具体错在什么地方了,具体source如下:C/C++ code? TCHAR szCommandLine[1024] = {0};sprintf(szCommandLine, "powershell -command \"& {get-windowsfeature | Out-File -FilePath C:\\Command.txt}\""); bSuccess = CreateProcess( NULL, // No module name (use command line). szCommandLine, // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE. 0, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi ); // Pointer to PROCESS_INFORMATION structure.