Hi,
I have what should be a very simple process.
I have a FOREACHLOOP container, that is set up to loop through files in a directory:
Enumerator: Foreach File Enumerator
Folder: c:\myfolder
Files: *.txt
Retrieve: Name and extension
Variable mappings: User::file_name, Index 0
So far, so good...
Then, inside the FOREACHLOOP, I have an Execute Process Task, which is simply a .bat file that I am running, and passing the name of the file to:
For example: myBat.bat file_name
In the Execute Process Task, I have:
RequireFullFileName: false
Executable: c:\myFile\myBat.bat
WorkingDirectory: c:\myFile
StandardInputVariable: User::file_name
Everything else is set to the defaults.
However, when I execute my container, I get the following error:
Error: 0xC0029151 at Execute Process Task, Execute Process Task: In Executing "c:\myFile\myBat.bat" " " at "c:\myFile", The process exit code was "1", while the the expected was "0".
Is there anything I am obviously doing wrong here at the package level? When I run the .bat file from the command line, it works fine.
Thanks
Even when I remove the Standard Input Variable, and just put file name as the Argument, I still get an error. This is just running the Execute Process Task, not the loop, for one file only.
|||Ok, I set the SucessValue = 1, instead of 0, and now it's running ok with the single file name argument.
However, when I change it back to the StandardInputVariable with the User::file_name, it doesn't run the batch file correctly, that is the batch file does not work as expected, which makes me wonder what the User::file_name variable looks like?
I set a breakpoint, but how can I see my watch variable?
Thanks!
|||Type User::file_name into the watch window.|||In the execute process task, if the processes uses command line arguments, as insome_executable.exe arg1
or
some_batch_file.bat arg2
use the Arguments property.
If the process to execute is properly invoked as below, then it is expecting and will use the standard input file stream, not a command line argument, so use the StandardInputVariable property. Note setting the StandardInputVariable to the "User::file_name" is streaming in the name of the file, NOT the contents of the file (as in the echo "x" case below).
echo "x" | some_executable.exe
If the process expects both command line arguments and standard input, as follows:
echo "x" | some_executable.exe arg1
then use both task properties as well.
No comments:
Post a Comment