PDA

View Full Version : Batch file can't find program


Darwin
12-23-2003, 07:25 PM
I have a project step that invokes a batch file. However, when the batch file runs, it's unable to locate an executable even though it's part of the PATH. Is the PATH being ignored?

Here's the Run Program proerties:
Command: %DOSCMD% c:\temp\test.bat
Start in: c:\temp
Read Output From: Standard output

Here's the test.bat batch file:
python.exe

python.exe is located in c:\util\python which is in the PATH. It can be invoked from the command prompt in any directory.

thx.
-Darwin

kevina
12-23-2003, 10:20 PM
This works for me in testing. Did you add the path to python.exe to your path after starting visual build pro? If so, you will need to restart VBP for it to know about the path change (just like any other application or command prompt).

Another way to verify that VBP knows about the path is add the PATH statement to your batch file (it will print the path to the Visual Build Pro log).

Kevin

Darwin
12-24-2003, 01:31 PM
- VBP was started after the PATH was modified.

- Adding PATH to the batch file shows that c:\util\python is there.

- I'm running VBP 4.6b

kinook
01-06-2004, 10:36 AM
Something must be missing, but I'm not sure what. I tried a similar test here:

1) Installed ActivePython 2.3.2.232 to C:\Python (it added C:\Python, where Python.exe was copied, to the PATH environment variable).

2) Created c:\temp\test.bat with contents 'python.exe'

3) Created c:\ptest.bld with contents
<step action='Run Program' type='0'>
<command>%DOSCMD% c:\temp\test.bat</command>
<name>New Step</name>
<outputfrom type='3'>1</outputfrom>
<startin>c:\temp</startin>
</step>

4) Built ptest.bld. Output:
Building project step 'New Step'...

c:\temp>python.exe
Build successfully completed.

5) Moved C:\Python\Python.exe to c:\ and rebuilt ptest.bld. Output:
Building project step 'New Step'...

c:\temp>python.exe
'python.exe' is not recognized as an internal or external command,
operable program or batch file.

Process completed with exit code 1
Step 'New Step' failed
Build ended.