0
是否有可能从asp.net核心网站的exec linux命令? 喜欢的东西是否有可能从asp .net应用程序运行linux配置命令
sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0
我的意思是,我需要在路由器的配置,如PC使用的Web UI
是否有可能从asp.net核心网站的exec linux命令? 喜欢的东西是否有可能从asp .net应用程序运行linux配置命令
sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0
我的意思是,我需要在路由器的配置,如PC使用的Web UI
您需要添加依赖关系的System.Diagnostics.Process API Reference
则可以执行bash命令状这个。 请将此视为伪代码,因为我不在Linux机器附近进行测试
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "/bin/bash";
psi.Arguments = "-c sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0";
psi.UseShellExecute = true;
psi.RedirectStandardOutput = true;
Process proc = new Process
{
StartInfo = psi
};
proc.Start();