Including a bat with arguments (that launchs a cmd window and adds commands to the path) into another bat
I have a bat file running a command :
C:WindowsSystem32cmd.exe /E:ON /V:ON /K ""C:Program Files (x86)pathtothecompilersscript.bat" option1 option2"
It basically opens a cmd windows for which different commands (intel compilers etc) are already in the path. Then, in this command window I cd
to a specific location and I use these intel commands as follows :
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .libfinal.dll "..libfinal.dll*" /Y
xcopy /s .libfinal.lib "..libfinal.lib*" /Y
which compile (with ifort
intel fortran compiler, but the question doesn't depend on it) libraries and copies them somewhere.
I would to wrap all above into a single bat file doing the whole job. I came up with :
call ""C:Program Files (x86)pathtothecompilersscript.bat" option1 option2"
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .libfinal.dll "..libfinal.dll*" /Y
xcopy /s .libfinal.lib "..libfinal.lib*" /Y
but running it gives me the following :
'""C:Program' is not recognized as an internal or external command
I checked Command Prompt Error 'C:Program' is not recognized as an internal or external command, operable program or batch file but did not succeed in adapting to my situation
Remark. option1
and option2
don't have spaces or anything requiring quoting, and if I use call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
I have the following error :
The input line is too long.
The syntax of the command is incorrect.
Remark. The true content of the call
line is :
call "C:Program Files (x86)IntelSWToolscompilers_and_libraries_2017.4.210windowsbinipsxe-comp-vars.bat" intel64 vs2015
windows batch-file cmd windows-10
add a comment |
I have a bat file running a command :
C:WindowsSystem32cmd.exe /E:ON /V:ON /K ""C:Program Files (x86)pathtothecompilersscript.bat" option1 option2"
It basically opens a cmd windows for which different commands (intel compilers etc) are already in the path. Then, in this command window I cd
to a specific location and I use these intel commands as follows :
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .libfinal.dll "..libfinal.dll*" /Y
xcopy /s .libfinal.lib "..libfinal.lib*" /Y
which compile (with ifort
intel fortran compiler, but the question doesn't depend on it) libraries and copies them somewhere.
I would to wrap all above into a single bat file doing the whole job. I came up with :
call ""C:Program Files (x86)pathtothecompilersscript.bat" option1 option2"
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .libfinal.dll "..libfinal.dll*" /Y
xcopy /s .libfinal.lib "..libfinal.lib*" /Y
but running it gives me the following :
'""C:Program' is not recognized as an internal or external command
I checked Command Prompt Error 'C:Program' is not recognized as an internal or external command, operable program or batch file but did not succeed in adapting to my situation
Remark. option1
and option2
don't have spaces or anything requiring quoting, and if I use call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
I have the following error :
The input line is too long.
The syntax of the command is incorrect.
Remark. The true content of the call
line is :
call "C:Program Files (x86)IntelSWToolscompilers_and_libraries_2017.4.210windowsbinipsxe-comp-vars.bat" intel64 vs2015
windows batch-file cmd windows-10
2
Did you try adjusting the quoting, e.g.Call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
. If one or both of the options require quoting you could additionally try doing so thus,Call "C:Program Files (x86)pathtothecompilersscript.bat" "option1" "option2"
.
– Compo
Jan 2 at 14:14
Yes I did (option1 and option2 do not require quoting) and hadThe input line is too long. The syntax of the command is incorrect.
– 11house
Jan 2 at 14:29
As we cannot see the true content of your path or your options, my only advice would be to first,PushD
orCD
to"C:Program Files (x86)pathtothecompilers"
, then tryCall script.bat option1 option2
. If you chosePushD
, then you may wish to add,PopD
, to the next line after theCall
line.
– Compo
Jan 2 at 15:32
@Compo Updated my question with the true content of thecall
line
– 11house
Jan 2 at 15:37
add a comment |
I have a bat file running a command :
C:WindowsSystem32cmd.exe /E:ON /V:ON /K ""C:Program Files (x86)pathtothecompilersscript.bat" option1 option2"
It basically opens a cmd windows for which different commands (intel compilers etc) are already in the path. Then, in this command window I cd
to a specific location and I use these intel commands as follows :
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .libfinal.dll "..libfinal.dll*" /Y
xcopy /s .libfinal.lib "..libfinal.lib*" /Y
which compile (with ifort
intel fortran compiler, but the question doesn't depend on it) libraries and copies them somewhere.
I would to wrap all above into a single bat file doing the whole job. I came up with :
call ""C:Program Files (x86)pathtothecompilersscript.bat" option1 option2"
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .libfinal.dll "..libfinal.dll*" /Y
xcopy /s .libfinal.lib "..libfinal.lib*" /Y
but running it gives me the following :
'""C:Program' is not recognized as an internal or external command
I checked Command Prompt Error 'C:Program' is not recognized as an internal or external command, operable program or batch file but did not succeed in adapting to my situation
Remark. option1
and option2
don't have spaces or anything requiring quoting, and if I use call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
I have the following error :
The input line is too long.
The syntax of the command is incorrect.
Remark. The true content of the call
line is :
call "C:Program Files (x86)IntelSWToolscompilers_and_libraries_2017.4.210windowsbinipsxe-comp-vars.bat" intel64 vs2015
windows batch-file cmd windows-10
I have a bat file running a command :
C:WindowsSystem32cmd.exe /E:ON /V:ON /K ""C:Program Files (x86)pathtothecompilersscript.bat" option1 option2"
It basically opens a cmd windows for which different commands (intel compilers etc) are already in the path. Then, in this command window I cd
to a specific location and I use these intel commands as follows :
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .libfinal.dll "..libfinal.dll*" /Y
xcopy /s .libfinal.lib "..libfinal.lib*" /Y
which compile (with ifort
intel fortran compiler, but the question doesn't depend on it) libraries and copies them somewhere.
I would to wrap all above into a single bat file doing the whole job. I came up with :
call ""C:Program Files (x86)pathtothecompilersscript.bat" option1 option2"
ifort -c -fpp file1.f90
ifort -c -fpp file2.f90
ifort -c -fpp file3.f90
ifort -dll -o libfinal.dll file1.obj file2.obj file3.obj
lib /out:./libfinal.lib file1.obj file2.obj file3.obj
xcopy /s .libfinal.dll "..libfinal.dll*" /Y
xcopy /s .libfinal.lib "..libfinal.lib*" /Y
but running it gives me the following :
'""C:Program' is not recognized as an internal or external command
I checked Command Prompt Error 'C:Program' is not recognized as an internal or external command, operable program or batch file but did not succeed in adapting to my situation
Remark. option1
and option2
don't have spaces or anything requiring quoting, and if I use call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
I have the following error :
The input line is too long.
The syntax of the command is incorrect.
Remark. The true content of the call
line is :
call "C:Program Files (x86)IntelSWToolscompilers_and_libraries_2017.4.210windowsbinipsxe-comp-vars.bat" intel64 vs2015
windows batch-file cmd windows-10
windows batch-file cmd windows-10
edited Jan 2 at 15:36
11house
asked Jan 2 at 14:08
11house11house
325
325
2
Did you try adjusting the quoting, e.g.Call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
. If one or both of the options require quoting you could additionally try doing so thus,Call "C:Program Files (x86)pathtothecompilersscript.bat" "option1" "option2"
.
– Compo
Jan 2 at 14:14
Yes I did (option1 and option2 do not require quoting) and hadThe input line is too long. The syntax of the command is incorrect.
– 11house
Jan 2 at 14:29
As we cannot see the true content of your path or your options, my only advice would be to first,PushD
orCD
to"C:Program Files (x86)pathtothecompilers"
, then tryCall script.bat option1 option2
. If you chosePushD
, then you may wish to add,PopD
, to the next line after theCall
line.
– Compo
Jan 2 at 15:32
@Compo Updated my question with the true content of thecall
line
– 11house
Jan 2 at 15:37
add a comment |
2
Did you try adjusting the quoting, e.g.Call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
. If one or both of the options require quoting you could additionally try doing so thus,Call "C:Program Files (x86)pathtothecompilersscript.bat" "option1" "option2"
.
– Compo
Jan 2 at 14:14
Yes I did (option1 and option2 do not require quoting) and hadThe input line is too long. The syntax of the command is incorrect.
– 11house
Jan 2 at 14:29
As we cannot see the true content of your path or your options, my only advice would be to first,PushD
orCD
to"C:Program Files (x86)pathtothecompilers"
, then tryCall script.bat option1 option2
. If you chosePushD
, then you may wish to add,PopD
, to the next line after theCall
line.
– Compo
Jan 2 at 15:32
@Compo Updated my question with the true content of thecall
line
– 11house
Jan 2 at 15:37
2
2
Did you try adjusting the quoting, e.g.
Call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
. If one or both of the options require quoting you could additionally try doing so thus, Call "C:Program Files (x86)pathtothecompilersscript.bat" "option1" "option2"
.– Compo
Jan 2 at 14:14
Did you try adjusting the quoting, e.g.
Call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
. If one or both of the options require quoting you could additionally try doing so thus, Call "C:Program Files (x86)pathtothecompilersscript.bat" "option1" "option2"
.– Compo
Jan 2 at 14:14
Yes I did (option1 and option2 do not require quoting) and had
The input line is too long. The syntax of the command is incorrect.
– 11house
Jan 2 at 14:29
Yes I did (option1 and option2 do not require quoting) and had
The input line is too long. The syntax of the command is incorrect.
– 11house
Jan 2 at 14:29
As we cannot see the true content of your path or your options, my only advice would be to first,
PushD
or CD
to "C:Program Files (x86)pathtothecompilers"
, then try Call script.bat option1 option2
. If you chose PushD
, then you may wish to add, PopD
, to the next line after the Call
line.– Compo
Jan 2 at 15:32
As we cannot see the true content of your path or your options, my only advice would be to first,
PushD
or CD
to "C:Program Files (x86)pathtothecompilers"
, then try Call script.bat option1 option2
. If you chose PushD
, then you may wish to add, PopD
, to the next line after the Call
line.– Compo
Jan 2 at 15:32
@Compo Updated my question with the true content of the
call
line– 11house
Jan 2 at 15:37
@Compo Updated my question with the true content of the
call
line– 11house
Jan 2 at 15:37
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2fstackoverflow.com%2fquestions%2f54007806%2fincluding-a-bat-with-arguments-that-launchs-a-cmd-window-and-adds-commands-to-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2fstackoverflow.com%2fquestions%2f54007806%2fincluding-a-bat-with-arguments-that-launchs-a-cmd-window-and-adds-commands-to-t%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
2
Did you try adjusting the quoting, e.g.
Call "C:Program Files (x86)pathtothecompilersscript.bat" option1 option2
. If one or both of the options require quoting you could additionally try doing so thus,Call "C:Program Files (x86)pathtothecompilersscript.bat" "option1" "option2"
.– Compo
Jan 2 at 14:14
Yes I did (option1 and option2 do not require quoting) and had
The input line is too long. The syntax of the command is incorrect.
– 11house
Jan 2 at 14:29
As we cannot see the true content of your path or your options, my only advice would be to first,
PushD
orCD
to"C:Program Files (x86)pathtothecompilers"
, then tryCall script.bat option1 option2
. If you chosePushD
, then you may wish to add,PopD
, to the next line after theCall
line.– Compo
Jan 2 at 15:32
@Compo Updated my question with the true content of the
call
line– 11house
Jan 2 at 15:37