|Hi . . .|
I'm not sure if this is exactly the right place to post this problem, but here goes . . .
I wanted to make a shortcut to change my IP address to static or dynamic, depending on which I've already got it set to . . .
So I made a little script in a batch file to do this, but when I run it, the CMD opens briefly (for less than a second) before closing itself straight away . . .
When I check my IP address settings, nothing changes . . .
Am I doing something wrong . . . ??
I haven't coded much before, just used AutoHotkey if anyone's heard of that, I nabbed these little bits of code from here and there on the internet to make sure that I was doing it right . . .
echo Please wait
type temp0 | findstr /i "address" >temp1
for /f "tokens=15" %%i IN (temp1) do (
echo @echo off>fix.bat
echo if not %%i==192.168.xx.xx set j=192.168.xx.xx>>fix.bat
echo if not %%i==192.168.xx.xx netsh int ip set address "local area connection" static %%j%% 255.255.255.0 192.168.xx.xx 1 >>fix.bat
echo if not %%i==192.168.xx.xx netsh interface ip set dns "Local Area Connection" static 192.168.xx.xx >>fix.bat
echo if %%i==192.168.xx.xx netsh interface ip set address "Local Area Connection" dhcp >>fix.bat
echo if %%i==192.168.xx.xx netsh interface ip set dns "Local Area Connection" dhcp >>fix.bat
del /q temp0
del /q temp1
del /q fix.bat
One other note, I have full administrative privileges and have even tried running this as administrator . . .
Any help would be greatly appreciated, thanks for looking . . . !!
Chris . . .