Howto call multiple exes from Node Preparation task
-
21 listopada 2011 20:38
I was playing around with the Node Preparation task, and I can't figure out how to have multiple steps in my task. For example, I want to create a directory and copy files into it. Hitting "Enter" to enter a new line closes the dialog. I tried using Ctrl-Enter which visually adds a newline and I enter a second instruction, but it seems like only the first instruction is executed. Any tips on how to do this?
Thanks
Wszystkie odpowiedzi
-
22 listopada 2011 22:42
The easiest way to do this is to use the '&' or '&&' operator between each step. The '&' operator executes each command regardless of previous command success while the '&&' operator causes the whole line to fail at the first command failure.
For example, the following line will try to make c:\test and store the current directory listing inside it:
mkdir c:\test & dir > c:\test\diroutput.txt
Using '&&' would cause this command to fail if c:\test already exists because the mkdir command would fail, while using '&' succeeds. Which one you need will depend on your command logic.
An alternatively solution for more complex tasks is to create a .cmd or .bat file containing the commands and have the task invoke the script.
Jeremy
- Oznaczony jako odpowiedź przez Rock2000 23 listopada 2011 14:06
-
23 listopada 2011 14:07
Neat trick. I wasn't aware of that. Works well (although it would be nice if HPC made this a little more friendly in the future).
Thanks