Task Close after process finishes.
Moderator: DosItHelp
Task Close after process finishes.
Hello,
I am having a bit of trouble figuring out how to kill a task after it has been completed in batch.
@echo off
gcit game.iso -f DiscEx -d J:\games\extracted\
I would like a line to follow that will close the task when it has finished its operation which could be 1 minute or 5 minutes. I have tried with taskkill and no success. I am not sure how to make it loop until the process is idle and then kill it so my other script can continue.
Thanks for your help.
I am having a bit of trouble figuring out how to kill a task after it has been completed in batch.
@echo off
gcit game.iso -f DiscEx -d J:\games\extracted\
I would like a line to follow that will close the task when it has finished its operation which could be 1 minute or 5 minutes. I have tried with taskkill and no success. I am not sure how to make it loop until the process is idle and then kill it so my other script can continue.
Thanks for your help.
Re: Task Close after process finishes.
Silent44 wrote:I am having a bit of trouble figuring out how to kill a task after it has been completed in batch.
@echo off
gcit game.iso -f DiscEx -d J:\games\extracted\
Google doesn't help determine what you are going. https://www.google.com.au/search?q=gcit
Re: Task Close after process finishes.
Why don't you use the [-Q|-Quit], Quit after the operation if there are no errors, or [-AQ|-AlwaysQuit], Quit after the operation even if there are errors, switches:
Additionally, (although it shouldn't be necessary), you could try using Start with Wait if you're wanting to run something after it.
In either case gcit would need to be in your path.
Code: Select all
@gcit game.iso -aq -f DiscEx -d J:\games\extracted
Additionally, (although it shouldn't be necessary), you could try using Start with Wait if you're wanting to run something after it.
Code: Select all
@Start /wait gcit game.iso -aq -f DiscEx -d J:\games\extracted
In either case gcit would need to be in your path.
Game Cube ISO Tool Script
removed~useless code
Last edited by Silent44 on 04 Mar 2015 11:53, edited 2 times in total.
Re: Task Close after process finishes.
Amazing what you can do when you read the help file for the progam you are using.
Code: Select all
Command line
gcit [Source] [Options]
Source is either an ISO filename or folder in GCReEx/DiscEx format.
All options are case insensitive.
-Quit or -Q
Quit after the operation if there's no errors.
-AlwaysQuit or -AQ
Quit after the operation even if there's errors.
Exit codes are as follows
0 - No error
1 - Error during operation
2 - User cancelled
3 - Command line error
-Flush
Flush the file buffers so that the SD card can be ejected almost immediately after the operation.
-Backup or -B
Save a backup of the original fst.bin and boot.bin files inside the trimmed ISO.
-Align or -A [4|32|32K]
Set the alignment used in the ISO. 4 bytes, 32 bytes or 32KB. Default is auto.
-Format or -F [GCReEx|DiscEx|FullISO]
Set the destination format. Default is Trimmed ISO.
-Dest or -D [filename|folder]
Set the output location.
GCReEx and DiscEx formats expect a folder.
The ISO formats expect a filename.
When extracting games from a GCOS multiboot disc, a folder is expected regardless of the output format.
Default is a file or folder called "out" in the same folder as the source.
Some simple examples of usage
gcit game.iso
gcit game.iso -b -d c:\backup\trimmed.iso
gcit game.iso -b -a 32K -d c:\backup\trimmed.iso
gcit game.iso -f gcreex -d e:\games
gcit game.iso -f DiscEx -d e:\games
gcit game.iso -q -flush -f FullISO -d "c:\folder with spaces\full.iso"
gcit multigame.iso -q -f discex -d "e:\games"
Re: Task Close after process finishes.
@Silent44, I'm not sure of your exact intentions, but does this single script not do the same as the two you've posted:
Code: Select all
@Echo Off & Setlocal
If %CD%\ NEq %~dp0 Pushd %~dp0
For %%A In (*.gcm *.iso) Do (
If Not Exist "%%~nA\" MD "%%~nA"
Move "%%~A" "%%~nA\game%%~xA"
If /I %%~xA Equ .iso Call Set Dirs=%%Dirs%% "%%~nA")
For %%A In (%Dirs%) Do (
"%~dp0gcit" "%%~nA\game.iso" -aq -f DiscEx -d "%~dp0Extracted")
Re: Task Close after process finishes.
Good Call Compo,
I didn't really look at the script until right now. That is a whacky way to process files.
I didn't really look at the script until right now. That is a whacky way to process files.
Re: Task Close after process finishes.
Yours works great, much thanks! 

Making Task Recursive
removed~useless code
Last edited by Silent44 on 04 Mar 2015 11:52, edited 1 time in total.
Re: Task Close after process finishes.
@Silent44, The people in this group, myself included, have no idea about your exact task, nor about the specific programs you are using. What we do know is how best to structure a script in order to best manage the processes required to achieve the goal.
You've now changed the goal and created additional batch files which we haven't seen, and have effectively ignored the majority of the help I've thus far given, (which was partly based incidentally on guess work). Did you read the code which you agreed works? Did you not try to figure out why I did certain things or wonder what my code was doing and where the main differences were from yours?
Let me give you an example of a 'whacky', (read insane), idea; "copying the gcit executable and two batch files into each and every folder in a tree"!
You need to help us to help you, provide us with the content of the additional batch files and try to explain what you are trying to do with a layout of the tree you are working with and showing the location of the main script within that tree.
You've now changed the goal and created additional batch files which we haven't seen, and have effectively ignored the majority of the help I've thus far given, (which was partly based incidentally on guess work). Did you read the code which you agreed works? Did you not try to figure out why I did certain things or wonder what my code was doing and where the main differences were from yours?
Let me give you an example of a 'whacky', (read insane), idea; "copying the gcit executable and two batch files into each and every folder in a tree"!
You need to help us to help you, provide us with the content of the additional batch files and try to explain what you are trying to do with a layout of the tree you are working with and showing the location of the main script within that tree.
Re: Task Close after process finishes.
removed~useless code
Last edited by Silent44 on 04 Mar 2015 11:50, edited 4 times in total.
Re: Task Close after process finishes.
Compo wrote:Let me give you an example of a 'whacky', (read insane), idea; "copying the gcit executable and two batch files into each and every folder in a tree"!
And doing it with THREE separate FOR /D commands when it could have been done with ONE!!!!!!!!!!!!!!!!!!
I have never seen such convoluted branching of code in my entire life.
Re: Task Close after process finishes.
What are the .gcm files and are they supposed to be renamed to game.gcm or do they remain named as they were?
What other same named files are along side the .gcm and .iso files and are being moved to the respective directories?
What other same named files are along side the .gcm and .iso files and are being moved to the respective directories?
Re: Task Close after process finishes.
removed~
Last edited by Silent44 on 04 Mar 2015 11:51, edited 1 time in total.
Game Cube ISO Tool Script - FINSIHED
FINAL UPDATE ~ everything is working great now!
Now I can just extract a zip file into my source directory containing all necessary bat files and programs.
Edit the start.bat to my destination directory and run the start.bat.
Final result = what I had originally hope for.
I guess the two for commands could be merged into one, but not sure how to do that.
Maybe like this:
I will test and see!
Thanks for your help Compo!
Game Cube ISO Tool Script
(-) = usage, (~) = explanations
- extract all files to your source directory
- edit start.bat ( set target=your destination directory )
~ extracts all gcm and iso files from archived folders in the source directory
~ trims the iso files and aligns at 32k (this can be edited in gcit-wit.bat)
~ creates a folder structure as follows ( Game Name [GAMEID] )
~ renames a corresponding iso file to game.iso and moves it to the folder structure above
~ results = \destination directory\Game Name [GAMEID]\game.iso
start.bat =
gcit-wit.bat =
Now I can just extract a zip file into my source directory containing all necessary bat files and programs.
Edit the start.bat to my destination directory and run the start.bat.
Final result = what I had originally hope for.
I guess the two for commands could be merged into one, but not sure how to do that.
Maybe like this:
Code: Select all
for /R %%i IN (.) do (
Rar.exe x "%%i/*.rar" %target%
Rar.exe x "%%i/*.001" %target%)
I will test and see!
Thanks for your help Compo!
Game Cube ISO Tool Script
(-) = usage, (~) = explanations
- extract all files to your source directory
- edit start.bat ( set target=your destination directory )
~ extracts all gcm and iso files from archived folders in the source directory
~ trims the iso files and aligns at 32k (this can be edited in gcit-wit.bat)
~ creates a folder structure as follows ( Game Name [GAMEID] )
~ renames a corresponding iso file to game.iso and moves it to the folder structure above
~ results = \destination directory\Game Name [GAMEID]\game.iso
start.bat =
Code: Select all
@echo off & setlocal
set target=
move gcit.exe %target%
move gcit-wit.bat %target%
move wit.exe %target%
for /R %%i IN (.) do Rar.exe x "%%i/*.rar" %target%
for /R %%i IN (.) do Rar.exe x "%%i/*.001" %target%
del rar.exe
pushd %target%
call gcit-wit.bat
del gcit.exe
del gcit-wit.bat
del wit.exe
del prefs.ini
del *.jpg
gcit-wit.bat =
Code: Select all
@echo off & Setlocal
GOTO WIT
:WIT
wit move *.iso *.gcm '%%T [%%6I].iso'
GOTO GCIT
:GCIT
If %CD%\ NEq %~dp0 Pushd %~dp0
For %%A In (*.iso) Do (
If Not Exist "%%~nA\" MD "%%~nA"
Move "%%~A" "%%~nA\game%%~xA"
If /I %%~xA Equ .iso Call Set Dirs=%%Dirs%% "%%~nA")
For %%A In (%Dirs%) Do (
"%~dp0gcit" "%%~nA\game.iso" -aq -a 32k -d "%~dp0%%~nA.iso")
If %CD%\ NEq %~dp0 Pushd %~dp0
For %%A In (*.iso) Do (
If Not Exist "%%~nA\" MD "%%~nA"
Move "%%~A" "%%~nA\game%%~xA"
If /I %%~xA Equ .iso Call Set Dirs=%%Dirs%% "%%~nA")