|
#1
|
|||
|
|||
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'> <Filename>%TEMP%\x.bat</Filename> <Text><![CDATA[@FOR /R %TEMP% /D %%%%f IN (*.*) DO copy NUL "%%%%f\Vers_081.txt" @IF %%ERRORLEVEL%% == 0 GOTO Done @rem this executes another statement that will succeed so the callee gets a 0 exitcode :Done]]></Text> <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> <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> </step> |
|
|