Why is this bat file not returning to the calling bat file?
Multi tool use
up vote
1
down vote
favorite
K:bin>type get_resolution.bat
i_view.bat "%1" /info=info.txt
echo after get_resolution
type info.txt | find "Resolution"
K:bin>type i_view.bat
echo %*
echo %errorlevel%
echo after i_view
K:bin>get_resolution.bat input.jpg
K:bin>i_view.bat "input.jpg" /info=info.txt
K:bin>echo "input.jpg" /info=info.txt
"input.jpg" /info=info.txt
K:bin>echo 0
0
K:bin>echo after i_view
after i_view
K:bin>
Why no "after get_resolution"?
windows-10
add a comment |
up vote
1
down vote
favorite
K:bin>type get_resolution.bat
i_view.bat "%1" /info=info.txt
echo after get_resolution
type info.txt | find "Resolution"
K:bin>type i_view.bat
echo %*
echo %errorlevel%
echo after i_view
K:bin>get_resolution.bat input.jpg
K:bin>i_view.bat "input.jpg" /info=info.txt
K:bin>echo "input.jpg" /info=info.txt
"input.jpg" /info=info.txt
K:bin>echo 0
0
K:bin>echo after i_view
after i_view
K:bin>
Why no "after get_resolution"?
windows-10
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
K:bin>type get_resolution.bat
i_view.bat "%1" /info=info.txt
echo after get_resolution
type info.txt | find "Resolution"
K:bin>type i_view.bat
echo %*
echo %errorlevel%
echo after i_view
K:bin>get_resolution.bat input.jpg
K:bin>i_view.bat "input.jpg" /info=info.txt
K:bin>echo "input.jpg" /info=info.txt
"input.jpg" /info=info.txt
K:bin>echo 0
0
K:bin>echo after i_view
after i_view
K:bin>
Why no "after get_resolution"?
windows-10
K:bin>type get_resolution.bat
i_view.bat "%1" /info=info.txt
echo after get_resolution
type info.txt | find "Resolution"
K:bin>type i_view.bat
echo %*
echo %errorlevel%
echo after i_view
K:bin>get_resolution.bat input.jpg
K:bin>i_view.bat "input.jpg" /info=info.txt
K:bin>echo "input.jpg" /info=info.txt
"input.jpg" /info=info.txt
K:bin>echo 0
0
K:bin>echo after i_view
after i_view
K:bin>
Why no "after get_resolution"?
windows-10
windows-10
asked Nov 15 at 13:44
Francky Leyn
223
223
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
Use the call
command. Without using this command, the batch file will "replace" the current one.
In your script, you'd put call i_view.bat "%1" /info=info.txt
.
cmd.exe /k
is equivalent.
Here's part of the help text from call /?
.
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
batch-parameters Specifies any command-line information required by the
batch program.
If Command Extensions are enabled CALL changes as follows:
CALL command now accepts labels as the target of the CALL. The syntax
is:
CALL :label arguments
A new batch file context is created with the specified arguments and
control is passed to the statement after the label specified. You must
"exit" twice by reaching the end of the batch script file twice. The
first time you read the end, control will return to just after the CALL
statement. The second time will exit the batch script. Type GOTO /?
for a description of the GOTO :EOF extension that will allow you to
"return" from a batch script.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Use the call
command. Without using this command, the batch file will "replace" the current one.
In your script, you'd put call i_view.bat "%1" /info=info.txt
.
cmd.exe /k
is equivalent.
Here's part of the help text from call /?
.
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
batch-parameters Specifies any command-line information required by the
batch program.
If Command Extensions are enabled CALL changes as follows:
CALL command now accepts labels as the target of the CALL. The syntax
is:
CALL :label arguments
A new batch file context is created with the specified arguments and
control is passed to the statement after the label specified. You must
"exit" twice by reaching the end of the batch script file twice. The
first time you read the end, control will return to just after the CALL
statement. The second time will exit the batch script. Type GOTO /?
for a description of the GOTO :EOF extension that will allow you to
"return" from a batch script.
add a comment |
up vote
2
down vote
Use the call
command. Without using this command, the batch file will "replace" the current one.
In your script, you'd put call i_view.bat "%1" /info=info.txt
.
cmd.exe /k
is equivalent.
Here's part of the help text from call /?
.
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
batch-parameters Specifies any command-line information required by the
batch program.
If Command Extensions are enabled CALL changes as follows:
CALL command now accepts labels as the target of the CALL. The syntax
is:
CALL :label arguments
A new batch file context is created with the specified arguments and
control is passed to the statement after the label specified. You must
"exit" twice by reaching the end of the batch script file twice. The
first time you read the end, control will return to just after the CALL
statement. The second time will exit the batch script. Type GOTO /?
for a description of the GOTO :EOF extension that will allow you to
"return" from a batch script.
add a comment |
up vote
2
down vote
up vote
2
down vote
Use the call
command. Without using this command, the batch file will "replace" the current one.
In your script, you'd put call i_view.bat "%1" /info=info.txt
.
cmd.exe /k
is equivalent.
Here's part of the help text from call /?
.
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
batch-parameters Specifies any command-line information required by the
batch program.
If Command Extensions are enabled CALL changes as follows:
CALL command now accepts labels as the target of the CALL. The syntax
is:
CALL :label arguments
A new batch file context is created with the specified arguments and
control is passed to the statement after the label specified. You must
"exit" twice by reaching the end of the batch script file twice. The
first time you read the end, control will return to just after the CALL
statement. The second time will exit the batch script. Type GOTO /?
for a description of the GOTO :EOF extension that will allow you to
"return" from a batch script.
Use the call
command. Without using this command, the batch file will "replace" the current one.
In your script, you'd put call i_view.bat "%1" /info=info.txt
.
cmd.exe /k
is equivalent.
Here's part of the help text from call /?
.
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
batch-parameters Specifies any command-line information required by the
batch program.
If Command Extensions are enabled CALL changes as follows:
CALL command now accepts labels as the target of the CALL. The syntax
is:
CALL :label arguments
A new batch file context is created with the specified arguments and
control is passed to the statement after the label specified. You must
"exit" twice by reaching the end of the batch script file twice. The
first time you read the end, control will return to just after the CALL
statement. The second time will exit the batch script. Type GOTO /?
for a description of the GOTO :EOF extension that will allow you to
"return" from a batch script.
answered Nov 15 at 13:46
LawrenceC
58.4k10100178
58.4k10100178
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375686%2fwhy-is-this-bat-file-not-returning-to-the-calling-bat-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
01DCBXpdgAadPhEZuSP