我需要一个脚本来更改所有Windows 7 pro X64 PC上的IP地址。
我已经尝试了该方法,但是下次运行它时,它会继续添加IP地址。
myStlyedText.addMouseListener(new MouseListener() {
@Override
public void mouseUp(MouseEvent e) {
System.out.println("MouseUp is fired");
}
@Override
public void mouseDown(MouseEvent e) {
if (certainStringClicked()) {
myStlyedText.notifyListeners( SWT.MouseUp, null );
openDialog();
}
}
@Override
public void mouseDoubleClick(MouseEvent e) {}
});
答案 0 :(得分:0)
这就是我所做的。
如果有人有更好的解决方案,请告诉我
Clear-Host
$site = @{
Site1=2;
Site2=3;
}
$site =$site.Values
$oldRange = "172.11."
foreach($s in $site)
{
$printer = wmic path win32_tcpipprinterport get hostaddress
$printer=$printer.Split('',[System.StringSplitOptions]::RemoveEmptyEntries)
if($printer)
{
foreach ($p in $printer)
{
$OldIP = $p
$OldIP2 = $OldIP -replace $oldRange, ""
$old = [bool]($OldIP -as [IPAddress])
if($old)
{
$sep = $OldIP.lastindexof(".")
$network = $OldIP.substring(0,$sep)
if("10.11."+$s -ne $network)
{
$NewIP = "10.11.$OldIP2"
$NewIP
wmic path win32_tcpipprinterport where "hostaddress = '$OldIP'" set hostaddress="$NewIP"
}else{
Write-Host "IP Already Changed"
}
}else
{
Write-Host "Not a IP address"
}
}
}else{
Write-Host "None Found"
}
}