命令执行
频道 @jahsfgj5fw6
You can view and join @jahsfgj5fw6 right away.
评分(满分 10) 5.8 评分(满分 10) 5.8 /10 系统评分 · 评分说明
- 订阅者
- 18,949
- 最近发帖
- 1 天前
资料采集于 2026-11-21 · 非实时
简介
You can view and join @jahsfgj5fw6 right away.
查看 Telegram 上的原始简介
You can view and join @jahsfgj5fw6 right away.
评分构成
算法 v1 · 评分说明系统基础分 5.8(1 + 维度贡献 4.81) · 最终 5.8
维度 输入 维度值 权重 贡献
内容质量 未经判官审核 (按中性值 0.5 计) · 40% 0.50 40% +1.80
安全风险 未经判官审核 (按中性值 0.5 计) · 30% 0.50 30% +1.35
受众规模 18,949 订阅者 · 12% 0.70 12% +0.76
近期活跃 最近发帖 1 天前 · 10% 1.00 10% +0.90
Telegram 认证 无认证 · 4% 0.00 4% —
官网互链 无关联工具 · 4% 0.00 4% —
近期动态
在 Telegram 查看全部对于C#通过程序来调用cmd命令的操作,网上有很多类似的文章,但很多都不行,竟是漫天的拷贝。我自己测试整理了一下。
代码:
string str = Console.ReadLine();
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false; //是否使用操作系统shell启动
p.StartInfo.RedirectStandardInput = true;//接受来自调用程序的输入信息
p.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息
p.StartInfo.RedirectStandardError = true;//重定向标准错误输出
p.StartInfo.CreateNoWindow = true;//不显示程序窗口
p.Start();//启动程序
//向cmd窗口发送输入信息
p.StandardInput.WriteLine(str + "&exit");
p.StandardInput.AutoFlush = true;
//p.StandardInput.WriteLine("e…
2 次浏览
#频道互推 #相似推荐
------------------------------
📢 小杂鱼漏打
📢 迪迦拯救昆明📸CCTV
📢 马桶先生
📢 三角洲MVP官方群
📢 天才交易员小福星日常
📢 简州 三角洲 【官方频道】
📢 kg集团
📢 昆明公开榜
📢 无忧三角洲官方频道
📢 白鹤拦截主频道
------------------------------
🤝 加入互推 · 获得曝光,赚邀请奖励
2 次浏览
因为我们需要根据不同的操作类型,选择不同的脚本来进行执行,所以我们需要在代码里面判断一下操作系统类型。我们可以通过 RuntimeInformation.IsOSPlatform来判断。
static void Main()
{
string fileName="shell/";
//根据系统使用不同的shell文件
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
fileName += "win.bat";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
fileName += "linux.sh";
}
2 次浏览 图片/视频
.在OSX上运行#
我在OSX上的.NET Core SDK版本为2.0.0 很久没更新了。
直接执行命令
2 次浏览 图片/视频
使用的系统环境为CentOS 7.2,.NET Core sdk版本为2.0.3。
直接执行命令结果如下:
2 次浏览 图片/视频