Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running Windows 7 64 bit Home Premium.

My new internet connection is a bit buggy, and I need to keep reconnecting. To make sure my computer keeps connected while I'm away, I created a script that reconnects every 30 minutes. Since it runs constantly, I wanted to make it run hidden, and found a working way: solution 1 on this answer.

However, without the command window, I'm not sure how to go about stopping the script when I need to. What I'm doing is looking up the cmd.exe process in the task manager and stop it, but I keep wondering: Is this a good way? Is there a better, more direct way, that doesn't require the task manager?

share|improve this question
1  
Make another batch file to kill the first? It'd be some kind of brutal process hunger games. –  Michael Frank Jan 10 at 1:19
1  
Wi-Fi or wired Ethernet? Please advise. Some radio devices interfere with Wi-Fi on a cyclical basis, especially console gaming headsets. Many, many devices can use the unlicensed Wi-Fi bands and if they are not true Wi-Fi, nothing stops them from putting out radio interference which shreds a Wi-Fi connection. –  K7AAY Jan 10 at 1:26
    
@MichaelFrank Good idea, not sure why I didn't think of that. Took me a bit, but got it working with taskkill. If you'd like to rewrite that as an answer, maybe referring to stackoverflow.com/q/16513288/2697421 , I would gladly accept it. –  Sampaio Jan 10 at 1:33
    
@K7AAY The connection is Wi-Fi, but the reconnection part is done, just looking for a way to kill the script. Thank you for your second comment, but as you can see in my previous comment, I found a way that works best for me (partially because when I use it, I can't stop picturing the "brutal process hunger games", I must admit). –  Sampaio Jan 10 at 1:37
    
@Sampaio I'm glad I've create a memory. Be thankful you aren't this guy though: thedailywtf.com/Articles/Classic-WTF-A-Crony-Joke.aspx –  Michael Frank Jan 10 at 1:41

2 Answers 2

up vote 1 down vote accepted

You could always just make another batch file to kill the first.

In your first batch file make sure you add:

@Echo Off
title batchname.bat

That way, in the second batch file you can kill it by calling:

taskkill /f /im cmd.exe /fi "windowtitle eq batchname.bat"

Source, provided by Sampaio.

share|improve this answer

An easier Task Manager method would use

schtasks /create /sc minute /mo 30 /tn "30 Minute Script" /tr \path\to\30min.vbs

  • and the last line of 30min.vbs sets up a new 30 minute job, to execute 30 minutes hence.

When you don't need it any more, kill the "30 Minute Script" with

schtasks /end /tn "30 Minute Script"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.