You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用PowerShell Get-Content向C++编译exe传参失败求助

PowerShell管道传递Get-Content内容到C++ exe失效问题排查

此前可通过PowerShell的Get-Content命令将文件内容传入C++编译生成的exe程序,但近期该方式突然失效,过往可用的所有exe均无法正常工作。

测试场景详情

测试代码(编译为test.exe)

#include <iostream>
using namespace std;

int main(){
    int test;
    cin >> test;
    cout << "Input is " << test << endl;
    return 0;
}

测试文本文件test.txt内容

10

执行的PowerShell命令

Get-Content test.txt | ./test.exe

实际输出

PS C:\Users\User\Desktop\C++ codes> Get-Content test.txt | ./test.exe
Input is 0

预期输出

Input is 10

test.txt十六进制转储信息

Path: C:\Users\User\Desktop\C++ codes\test.txt

           00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000   31 30                                            10

恳请协助排查问题原因。

内容的提问来源于stack exchange,提问作者Kevin OuO

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 10:33:10