Execute Multiple Lines of Shell Commands In One Line in Agent Procedures

Question:

How to execute multiple lines of Shell Commands In One Line in Agent Procedures

Answer:

Sometimes, certain windows shell commands won't run if you are not in the proper directory. The reasons for this can include but are not limited to:

  • If you need to echo the directory you are in
  • If you are trying to run a command that is restricted by folder permissions

 

To accomplish this, you can run multiple commands in one line using the '&&' characters. An example of this would be:

cd "c:\Users\" && dir

 

This will return the folder contents of C:\Users\. Although this is a very simple example, you can increase the complexity of the final result and allows for further complexity and possibilities to your procedures.

 

Applies to:

ExecuteshellCommand()

ExecuteShellCommandToVariable()

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Contact us