1.

Solve : Batch file to restart wireless connection & program?

Answer»

Hi.. not familiar with scripting, reading many forums have pieced together an incorrect WAY of doing it.. so have GIVEN up and DECIDED to ask the experts

In Win 7 (x64) I need a batch file that will:
1- Disable my Wireless connection
2- Kill a program
3- Wait for said program to completely stop
4- Enable my Wireless connection
5- Wait for Wireless connection to re-establish
6- Start program that was killed

My lame attempt:
netsh interface set interface "Wireless Network Connection" DISABLE
@echo off
taskkill /f /IM ABC.exe
tasklist | find /i "abc"
@start "" /wait "abc.exe"
netsh interface set interface "Wireless Network Connection" ENABLE
timeout /t 30
start abc

Once you can manage to stop laughing/crying at the "way off" attempt above... I'd appreciate you putting me out of my misery.

See if this is any better. I'm assuming you got the netsh commands right at least.

Code: [Select]@echo off
netsh interface set interface "Wireless Network Connection" DISABLE
taskkill /f /IM "abc.exe"
:loop
tasklist | find /i "abc.exe" >nul || (timeout 5 & goto :loop)
netsh interface set interface "Wireless Network Connection" ENABLE
timeout 30
start "" "c:\path\abc.exe"



Discussion

No Comment Found