locked
Howto call multiple exes from Node Preparation task RRS feed

  • Question

  • 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

    Monday, November 21, 2011 8:38 PM

Answers

  • 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

     

    • Marked as answer by Rock2000 Wednesday, November 23, 2011 2:06 PM
    Tuesday, November 22, 2011 10:42 PM

All replies

  • 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

     

    • Marked as answer by Rock2000 Wednesday, November 23, 2011 2:06 PM
    Tuesday, November 22, 2011 10:42 PM
  • 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

    Wednesday, November 23, 2011 2:07 PM