1

I have a bat file running a command :

C:\Windows\System32\cmd.exe /E:ON /V:ON /K ""C:\Program Files (x86)\path\to\the\compilers\script.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)\path\to\the\compilers\script.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)\path\to\the\compilers\script.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)\IntelSWTools\compilers_and_libraries_2017.4.210\windows\bin\ipsxe-comp-vars.bat" intel64 vs2015
11house
  • 77
  • 7
  • 2
    Did you try adjusting the quoting, e.g. `Call "C:\Program Files (x86)\path\to\the\compilers\script.bat" option1 option2`. If one or both of the options require quoting you could additionally try doing so thus, `Call "C:\Program Files (x86)\path\to\the\compilers\script.bat" "option1" "option2"`. – Compo Jan 02 '19 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 02 '19 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)\path\to\the\compilers"`, 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 02 '19 at 15:32
  • @Compo Updated my question with the true content of the `call` line – 11house Jan 02 '19 at 15:37

0 Answers0