1.

Solve : Help needed with this batch file?

Answer»

Firstly I want to make it clear that I have no EXPERIENCE in this. Using Win 7 x64. I'm playing a game and somehow another program called Netlimiter is interfering with the game's online. With some experimentation, I figured out that if I close Netlimiter before starting the game, then start the game, then start that program again by Alt+Tab-ing to the DESKTOP -- then the game runs fine.

After this DISCOVERY, the next thing that came to my mind was to have a batch script that could do it automatically and save me the hassle. But as I said, I have no experience in batch scripts or even DOS commands. I have been searching the web for almost a day and came up myself with this script that seems to work. I have put the batch file in the game FOLDER.

Code: [Select]ECHO off

Taskkill /F /IM NLClientApp.exe

start Monopoly.exe

TIMEOUT /T 10 /NOBREAK

start /d "C:\Program Files\Locktime Software\NetLimiter 4\" NLClientApp.exe

But then there is one annoyance. When Netlimiter starts again(in system tray), it switches my game back to the desktop and then I have to manually click on the game window to go back into the game. Is there any way the above script can be modified so that either this can be prevented, or maybe switch the focus back to the game automatically?

I'd really appreciate any help. I hope I have explained this well enough.I don't know of any way to execute a batch file without it taking application focus.

However you might be able to do it with VBScript. See this thread for info that might help.

Quote from: nil on May 19, 2020, 05:25:24 PM

I don't know of any way to execute a batch file without it taking application focus.

However you might be able to do it with VBScript. See this thread for info that might help.
No, actually it's not the batch file taking focus. As you can see that I'm using it to run the game as well, thus it automatically switches to the game window. The issue is that in the last line where Netlimiter starts again in the system tray, my game window minimizes to desktop for whatever reason. I read that it only takes app focus if the app has a window which isn't the case here, so Idk why it's happening. But anyway, if somehow the focus could be brought back to the game, then that's all I'm looking for.Sorry, what I meant was, I don't know of any way to start a program from the command line (or a batch file) which can specify that the new program should not take focus.

However, VBS allows you to do that. So if you refactor your batch file as a VBScript, it might do what you want.

Ultimately however the application is going to decide whether it's focused or not. If there's code in Netlimiter that specifically takes control of application focus, you're probably just gonna have to live with it.


Discussion

No Comment Found