I am still relatively new to batch scripts. I am trying to write a script to execute some matlab commands, essentially run a matlab script on a 32 bit version and a 64 bit version from Windows 7.
When i run the commands in the DOS prompt, everything works as i expect, but when they are run as a script, i get an error message saying that the system cannot find the path specified
script.bat
@echo off set RESTORE=restoredefaultpath set HOMEDIRECTORY=P:\ISARLAB\IsarLab-Dev set SCRIPTNAME=packageScript set MATLABCOMMAND="%RESTORE%; cd %HOMEDIRECTORY%; %SCRIPTNAME%" echo launching Matlab 32 bit ... ::32 bit Matlab on Windows set MATLAB32BIT="C:\Prorgram Files\MATLAB\R2012b-32bit\bin\matlab.exe" echo %MATLAB32BIT% -r %MATLABCOMMAND% %MATLAB32BIT% -r %MATLABCOMMAND% @echo on output from script:
launching Matlab 32 bit ... "C:\Prorgram Files\MATLAB\R2012b-32bit\bin\matlab.exe" -r "restoredefaultpath; cd P:\ISARLAB\IsarLab-Dev; packageScript" The system cannot find the path specified. I have confirmed that the path specified is correct and the correct version of Matlab is launched when this .exe is executed.
commands run at dos prompt (this works):
set RESTORE=restoredefaultpath set HOMEDIRECTORY=P:\ISARLAB\IsarLab-Dev set SCRIPTNAME=packageScript set MATLABCOMMAND="%RESTORE%; cd %HOMEDIRECTORY%; %SCRIPTNAME%" set MATLAB32BIT="C:\Prorgram Files\MATLAB\R2012b-32bit\bin\matlab.exe" %MATLAB32BIT% -r %MATLABCOMMAND% Can someone explain why the commands work in the dos prompt but not in a script?
C:\Prorgram Files. Check your spelling ofProgram. Neither the batch file or the command line version will work with that spelling.