View Single Post
Old 04-01-2004, 09:22 AM
kinook kinook is online now
Join Date: 03-06-2001
Location: Colorado
Posts: 5,754
This seems to be a general problem when calling cmd /c FOR. One workaround is to put the FOR call in a batch file (which tests the exitcode itself and performs a no-op statement to force a 0 exitcode on success). This can be copied/pasted into VBP:

<step action='Write File' type='0'>
<Text><![CDATA[@FOR /R %TEMP% /D %%%%f IN (*.*) DO copy NUL "%%%%f\Vers_081.txt"
@rem this executes another statement that will succeed so the callee gets a 0 exitcode
<description>Create a temporary batch file to perform a FOR command and ensure a 0 exitcode on success when called via cmd /c</description>
<indent type='3'>1</indent>
<name>create batch file</name>
<step action='Run Program' type='0'>
<command>%DOSCMD% call "%TEMP%\x.bat"</command>
<description>Call the temporary batch file that was created</description>
<indent type='3'>1</indent>
<name>call batch file</name>
<outputfrom type='3'>1</outputfrom>
Reply With Quote