程序实现动态改变IP地址
来源:岁月联盟
时间:2006-03-20
在CMD下有个命令netsh是非常有用的,键入netsh后打help会看到很多有用的信息。
netsh>help
netsh>interface
netsh>dump
你将会看到当前的网络配置。
ok,如果你用
netsh>dump>exit 或者quit退出
在cmd下输入管道命令 netsh -c interface dump >c:/1.txt
则在c:根目录下生成1.txt,里面记载了当前的网络配置。
在cmd下再输入netsh -f c:/1.txt,又将网络配置信息读入当前网络设置。
好了,这样就清楚了。
C# 用System.Diagnostics.Process.Start("cmd.exe -C ",strCmd);
java 用Process ld = Runtime.getRuntime().exec(commands);
windowsAPI用ShellExecute,WInExec,CreateProcess,CreatePipe;
数据库存储过程用xp_cmdshell;:),哈哈,开玩笑
C里面就用System("Cmd -c ....")