MATLAB: Running the bat file

running the bat file

I have bat file named data.bat with simple command "python". When i double click the bat file python is running successfully. But when i run the bat file from MATLAB using the commands below,
dos('C:\Users\W25VCSQ\Desktop\data.bat &') or system('data.bat')
I am getting the error "The command python is either false or not found"
How should i call the bat file or how should the bat file should be written?
Thanks a lot

Best Answer

When the new process is spawned, it inherits default environment (PATH and other variables). If python isn't installed on that default path, it won't be found. Have the .bat file set any environment variables it needs or modify the startup environment to make that a global setting all sessions will inherit. The former is probably the more appropriate rather than modifying system.