Howto call multiple exes from Node Preparation task

답변됨 Howto call multiple exes from Node Preparation task

  • 2011년 11월 21일 월요일 오후 8: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

모든 응답

  • 2011년 11월 22일 화요일 오후 10: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

     

    • 답변으로 표시됨 Rock2000 2011년 11월 23일 수요일 오후 2:06
    •  
  • 2011년 11월 23일 수요일 오후 2: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