21 พฤศจิกายน 2554 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?
22 พฤศจิกายน 2554 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.
- ทำเครื่องหมายเป็นคำตอบโดย Rock2000 23 พฤศจิกายน 2554 14:06
23 พฤศจิกายน 2554 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).