Friday, 15 February 2013

Batch files - is not recognized as an internal command -



Batch files - is not recognized as an internal command -

i created a. batch run model follows. in command prompt (dos) this: c:\program files\portico\portico-1.0.2\exec> executeportico.bat name_model

example: executeportico.bat examplecppfederate

but error:

'c: \ documents' not recognized internal command or external, operable programme or batch file. "c:\program files\portico\portico-1.0.2\examples\cpp\cpp13\" examplecppfe derate.cpp press key continue. . . '"c:\program files\portico\portico-1.0.2\examples\cpp\cpp13\" examplecppf ederate2 'is not recognized internal command or external, operable programme or batch file. terminated - normal

see code:

@echo off rem ########################### rem # implementation/version # rem ########################### rem ################################ rem # check command line arguments # rem ################################ :checkargs if "%0" == "" goto usage if "%1" == "" goto usage rem ####################### rem # test java_home # rem ####################### if "%java_home%" == "" goto nojava goto rtihometest :nojava echo error java_home environment variable not set! goto usage rem ####################### rem # test rti_home # rem ####################### :rtihometest phone call c:\arquivos de programas\portico\portico-1.0.2\etc\confvarsc.bat if not "%rti_home%" == "" goto execute ############################################ ### (target) execute ####################### ############################################ :execute shift set path=%java_home%\jre\bin\client;%rti_home%\bin;%path% set rti_feddir="c:\arquivos de programas\portico\portico-1.0.2\examples\cpp\cpp13\" set exec="c:\arquivos de programas\portico\portico-1.0.2\examples\cpp\cpp13\" if "%0" == "m" goto exec1 :exec1 echo %exec%%1%.cpp pause %exec%%1%.cpp %2 goto finish :usage echo usage: executeportico.bat [model] [nome modelo] goto err :err echo terminated - error goto end :finish echo terminated - normal :end

i need following: need run examples in software way created file. bat in command prompt run thus: executaportic.bat name_model did this:

@echo off rem ########################### rem # implementation/version # rem ########################### rem ################################ rem # check command line arguments # rem ################################ :checkargs if "%0"=="" goto usage if "%1"=="" goto usage rem ####################### rem # test java_home # rem ####################### if "%java_home%"=="" goto nojava goto rtihometest :nojava echo error java_home environment variable not set! goto usage rem ####################### rem # test rti_home # rem ####################### :rtihometest phone call c:\portico\portico-1.0.2\etc\confvarsc.bat if not "%rti_home%"=="" goto execute ############################################ ### (target) execute ####################### ############################################ :execute shift set path=%java_home%\jre\bin\client;%rti_home%\bin;%path% set rti_feddir=c:\portico\portico-1.0.2\examples\cpp\cpp13\ set exec=c:\portico\portico-1.0.2\examples\cpp\cpp13\ rem ########################### rem # if "%0"=="m" goto exec1 rem ########################### goto exec1 :exec1 echo %exec%%1.exe pause "%exec%%1.exe" %2 goto finish :usage echo usage: executeportico.bat [model] [nome modelo] goto err :err echo terminated - error goto end :finish echo terminated - normal :end

but error: c:\portico\portico-1.0.2\exec>executeportic.bat main input line long.

i fixed couple of other minor syntax errors, such replacing %1% %1 , adding quotation marks call blah\blah\confvarsc.bat line. there couple of other potential problems can't prepare without knowing script expects arguments or seeing illustration usage. marked !!!!!! comments.

@echo off rem ########################### rem # implementation/version # rem ########################### rem ################################ rem # check command line arguments # rem ################################ :checkargs if #%1==# goto usage if #%2==# goto usage rem ####################### rem # test java_home # rem ####################### if "%java_home%"=="" goto nojava goto rtihometest :nojava echo error java_home environment variable not set! goto usage rem ####################### rem # test rti_home # rem ####################### :rtihometest phone call "c:\arquivos de programas\portico\portico-1.0.2\etc\confvarsc.bat" if not "%rti_home%"=="" goto execute rem ############################################ rem ### (target) execute ####################### rem ############################################ :execute rem !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! rem !!!! shift useful if have more !!!! rem !!!! 9 arguments. otherwise, there's no !!!! rem !!!! reason utilize it. after this, can't !!!! rem !!!! tell whether expect %2 !!!! rem !!!! sec script argument or third. !!!! rem !!!! -- rojo !!!! rem !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shift set path=%java_home%\jre\bin\client;%rti_home%\bin;%path% set rti_feddir=c:\arquivos de programas\portico\portico-1.0.2\examples\cpp\cpp13\ set exec=c:\arquivos de programas\portico\portico-1.0.2\examples\cpp\cpp13\ if "%0"=="m" goto exec1 rem !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! rem !!!! shouldn't there sort of !!!!! rem !!!! "else goto" statement here? !!!!! rem !!!! script runs now, goto !!!!! rem !!!! exec1 regardless of whether !!!!! rem !!!! "%0"=="m" -- rojo !!!!! rem !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :exec1 echo %exec%%1.cpp pause "%exec%%1.cpp" %2 goto finish :usage echo usage: executeportico.bat [model] [nome modelo] goto err :err echo terminated - error goto end :finish echo terminated - normal :end

batch-file

No comments:

Post a Comment