start and stop programs with batch?


Recommended Posts

i wanna write a batch or some sort of script that will kill a given set of programs before i play a game, and then be able to double click another bat file that will launch all of those programs again after the game.

i figured out how to use the @call command to launch one program, but it doesnt wanna just continue on to the next program. any help or ideas? thanks.

Link to comment
https://www.neowin.net/forum/topic/266875-start-and-stop-programs-with-batch/
Share on other sites

Starting those programs can be accomplished by using "start" in NT/2k/XP--it'll spin-off another shell to execute that program, so you can continue on with what you're doing. I'm not sure about the reverse though--it'd be difficult to obtain the process ID's of the processes you want to terminate.

  zeta said:
Starting those programs can be accomplished by using "start" in NT/2k/XP--it'll spin-off another shell to execute that program, so you can continue on with what you're doing. I'm not sure about the reverse though--it'd be difficult to obtain the process ID's of the processes you want to terminate.

585233412[/snapback]

when i use the start command it just opens up command prompt windows. here is my batch file so far...

  Quote
@start "C:\Program Files\GetRight\getright.exe"

@start "C:\Program Files\Palm\HOTSYNC.EXE"

@start "C:\Program Files\Pixoria\Konfabulator\Konfabulator.exe"

@start "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"

oh and i found an app that kills a program based on its name and if i can figure out how to execute all of these programs i can write that up as launching a program in the batch file.

ah, i figured it out... for anyone that wants it...

  Quote
cd "C:\Program Files\GetRight"

start getright

cd "C:\Program Files\Palm"

start HOTSYNC

cd "C:\Program Files\Pixoria\Konfabulator"

start Konfabulator

cd "C:\Program Files\Stardock\ObjectDock"

start ObjectDock

thats the sorta syntax you gotta use. works like a charm.

try this:

@start "" "C:\Program Files\GetRight\getright.exe"
@start "" "C:\Program Files\Palm\HOTSYNC.EXE"
@start "" "C:\Program Files\Pixoria\Konfabulator\Konfabulator.exe"
@start "" "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"

the reason for the extra quotes is because the first set of quotes indicates the Text for the Titlebar of the command window.

to kill a task:

taskkill /f /im mspaint.exe

(note: i believe taskkill only comes with XP Pro)

  cpugeniusmv said:
taskkill /f /im mspaint.exe

(note:  i believe taskkill only comes with XP Pro)

585233984[/snapback]

Don't work in Windows 2003 STD :blink:

ERROR: The remonte system must be running Windows 2000 or above.

How to stop Running Processes (includes symantec,avg and sygate)

(they must have the same name as described in services. the below removes access to internet also.

All inorder to free up resources for better game/application work

completly safe

run the lower one (start) to restart them

  Quote
NET STOP "Cryptographic Services"

NET STOP "DHCP Client"

NET STOP "DNS Client"

NET STOP "Network Connections"

NET STOP "Norton AntiVirus Auto Protect Service"

NET STOP "Print Spooler"

NET STOP "Protected Storage"

NET STOP "Remote Access Auto Connection Manager"

NET STOP "Shell Hardware Detection

NET STOP "Symantec Event Manager"

NET STOP "Task Scheduler"

NET STOP "Themes"

NET STOP "Windows Management Instrumentation"

NET STOP "Windows Time"

NET STOP "AVG7 Alert Manager Server"

NET STOP "AVG7 Update Service"

NET STOP "Sygate Personal Firewall Pro"

@PAUSE

Start Processes again

  Quote
NET START "Cryptographic Services"

NET START "DHCP Client"

NET START "DNS Client"

NET START "Network Connections"

NET START "Norton AntiVirus Auto Protect Service"

NET START "Print Spooler"

NET START "Protected Storage"

NET START "Remote Access Auto Connection Manager"

NET START "Shell Hardware Detection

NET START "Symantec Event Manager"

NET START "Task Scheduler"

NET START "Themes"

NET START "Windows Management Instrumentation"

NET START "Windows Time"

NET START "AVG7 Alert Manager Server"

NET START "AVG7 Update Service"

NET START "Sygate Personal Firewall Pro"

Or you use FSAutoStart from http://www.kensalter.com/fsautostart/

Description:

FSAutoStart gives the user the ability to automatically shutdown services and programs to provide as much resources to running today's most demanding games and applications.  It also provides the ability to launch selected programs after the selected application is launched.  Lastly, it can automatically restart those programs and services previously shutdown, thus bringing the computer back to its original state.  It also adds performance enhancing options like Defragment Memory.

It?s Free ;)

Well my batch file kills all services and programs then launchs my game and then waits for the game to quit and then automatticly relaunchs all services and programs. Its done with the /wait or /w switch. hehe

So only have to run batch once. And I hide the window using ConsoleTool /HIDE. Search google. ;) I also perfer to use process -q and process -k. Again google. ;)

Well since all the services where already posted above here is just a sample, part of my quake 3 config.

@echo off
ConsoleTool /HIDE
Start /d"E:\Program Files\Quake III Arena" Minimizer.exe
Start /d"E:\Program Files\Quake III Arena" gapa.exe
CHOICE.COM /N /CY /TY,4 >NUL
Start /w /d"E:\Program Files\Quake III Arena" quake3.exe +set fs_game q3ut3 +nosplash +set com_hunkmegs 128 +com_zoneMegs 32 +com_soundmegs 8 +seta s_khz "22" +_windowed_mouse 1 -dinput
CHOICE.COM /N /CY /TY,3 >NUL
process -q Minimizer.exe
CHOICE.COM /N /CY /TY,3 >NUL
process -k gapa.exe
cls

Thats the better way to use start, notice no cd bs. :)

Oh and I use CHOICE.COM too which pauses the batch file for time. Again google it.

Edited by war
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Still won't get me in one, I prefer a human driver.
    • Sony's region restrictions on PC begin lifting, bringing back PlayStation ports for everyone by Pulasthi Ariyasinghe 2023 was when Sony began its region-locking initiative on the PC platform. The move affected over 100 countries, restricting the purchase of popular PlayStation ports and live service experiences for anyone in the regions outside of Sony's choosing. However, it seems the company is finally opening up access to these countries, starting today. While Sony has made no official announcements, which was also how the original restrictions came to be, users in these regions have begun seeing most of the publisher's catalog reappearing on their Steam store platforms. The change can be seen on affected games' SteamDB histories as well. For example, on Helldivers 2, a popular but blocked multiplayer game from before, it can be seen that the 'PurchaseRestrictedCountries' flag has been removed from a large number of countries just a few hours ago, on June 13. The controversy began in 2023 when Sony began requiring PlayStation Network accounts for their PC ports, even for games that did not have any online elements. Following an uproar, especially regarding Helldivers 2, the company reversed course and made it an optional account on PC. Unfortunately, Sony did not lift the regional restrictions it placed on the countries that do not officially support PlayStation Network accounts, which amounts to well over 100 regions. As for what may have changed the company's mind about this, Stellar Blade may have played a big role. The Sony-published action game by Shift Up just released on PC to an absolutely massive audience, with it already touting almost 200,000 concurrent players on the Steam platform. While its demo was originally region restricted, the developer had worked with Sony to remove these locks and launch the game globally. Just a few days later, almost the entire PlayStation catalog has gone through the same process. Interestingly, while massive PlayStation titles like Helldivers 2, God of War Ragnarok, Spider-Man 2, and The Last of Us Part II Remastered are back to being available across most regions, it seems Ghost of Tsushima is still under the original restrictions. It's unclear why the title has not joined the rest in shedding its locks.
    • Easy to switch off Ai on macOS, just a couple of clicks, something that is not possible on Windows, it is just hidden. Even Android it is possible at the moment to switch off AI, by not installing the app and keeping Google Assistant as it is. Not really possible to use anything else but IOS or Android for smartphones, since that is all that is available, unless I go for a non-smart phone. My problem, certainly with Windows, is that Ms thinks we all want to use AI and don't make it easy to disable. I only use my Windows machine for games these days and will be staying with Windows 10. I use my Mac for everything else, at least Apple gives the choice as i said above to turn AI off.
    • I think X3D is distinct from "X" alone, weren't most early X3D chips clock locked?
  • Recent Achievements

    • Explorer
      Case_f went up a rank
      Explorer
    • Conversation Starter
      Jamie Smith earned a badge
      Conversation Starter
    • First Post
      NeoToad777 earned a badge
      First Post
    • Week One Done
      JoeV earned a badge
      Week One Done
    • One Month Later
      VAT Services in UAE earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      537
    2. 2
      ATLien_0
      230
    3. 3
      +Edouard
      154
    4. 4
      +FloatingFatMan
      149
    5. 5
      Michael Scrip
      108
  • Tell a friend

    Love Neowin? Tell a friend!