## Program that runs other programs, then shuts down?

Any other tech-related topics
Message
Author
bzl333
Posts: 167
Joined: Wed Jan 12, 2011 3:11 pm

### Program that runs other programs, then shuts down?

Hi,
was trying to do this with some batch files but i don't know enough to write them correctly i guess.

was just looking for a program that would run several other programs(their command line versions i guess are all thats possible?) stuff like CCleaner, BleachBit, and then maybe a defrag program - one after the other in sequence, and then when they are done shut down the computer.

guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

### Re: Program that runs other programs, then shuts down?

Search for Shutdown.

SYSTEM
Posts: 1969
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

### Re: Program that runs other programs, then shuts down?

It is indeed possible with a batch file, provided that each program closes when it's done.

Something like:

Code: Select all

C:\path\to\program.exe /AUTO
E:\path\to\another\program.exe

REM this shuts down the computer
C:\Windows\System32\shutdown.exe /s /t 0

My YouTube channel | Release date of my 13th playlist: August 24, 2020

bzl333
Posts: 167
Joined: Wed Jan 12, 2011 3:11 pm

### Re: Program that runs other programs, then shuts down?

guinness wrote:Search for Shutdown.
thanks, it takes a while to wade thru them. always get sidetracked on this site.

SYSTEM wrote:It is indeed possible with a batch file, provided that each program closes when it's done.

Something like:

Code: Select all

C:\path\to\program.exe /AUTO
E:\path\to\another\program.exe

REM this shuts down the computer
C:\Windows\System32\shutdown.exe /s /t 0


ECHO OFF

CALL BleachBit_console.bat
CALL ccleaner.bat
and it would pause after the first one for some reason. i don't know any of this
stuff, just tried to pick up a few clues from that stackoverflow site i think it was but
they didn't address this specifically, where one program starts and finishes and then the next one starts and finishes.

i'll try your code there next

SYSTEM
Posts: 1969
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

### Re: Program that runs other programs, then shuts down?

bzl333 wrote: oki, i had this:

ECHO OFF

CALL BleachBit_console.bat
CALL ccleaner.bat
and it would pause after the first one for some reason. i don't know any of this
stuff, just tried to pick up a few clues from that stackoverflow site i think it was but
they didn't address this specifically, where one program starts and finishes and then the next one starts and finishes.

i'll try your code there next
CALL is supposed to return control to the parent script when the child script has been run, so your example should have worked. Are you sure that BleachBit_console.bat doesn't have a "pause" command at the end?
My YouTube channel | Release date of my 13th playlist: August 24, 2020

bzl333
Posts: 167
Joined: Wed Jan 12, 2011 3:11 pm

### Re: Program that runs other programs, then shuts down?

SYSTEM wrote: CALL is supposed to return control to the parent script when the child script has been run, so your example should have worked. Are you sure that BleachBit_console.bat doesn't have a "pause" command at the end?
wow, there was a pause command there
seems to work fine now.

thanks

guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

### Re: Program that runs other programs, then shuts down?

I wonder when batch scripting will become obsolete?

Midas
Posts: 5815
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

### Re: Program that runs other programs, then shuts down?

guinness wrote:I wonder when batch scripting will become obsolete?
When BASh gets a native port for Windows... ?

SYSTEM
Posts: 1969
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

### Re: Program that runs other programs, then shuts down?

guinness wrote:I wonder when batch scripting will become obsolete?
Never?

Batch has the advantage that it works out of the box. You don't need to download a third-party interpreter in order to run batch files.
My YouTube channel | Release date of my 13th playlist: August 24, 2020

guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

### Re: Program that runs other programs, then shuts down?

Just read the wiki page for batch, didn't know KiXtart was developed by a Microsoft employee.