Commands using Cmd

Hey there everybody!
Please can you help me with this? I need running Multiple Commands using Cmd, for example in the cmd console, I write this:

C:\Users\test>cd C:\Test\01
C:\Test\01>AFUWIN.EXE APP.CAP /p /r

I try to from bigfix:

waithidden cmd.exe cd C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\actionsite\__Download
waithidden cmd.exe AFUWIN.EXE APP.CAP /p /r

But this not working. Can you help me please?

Each of those commands are invoked as a separate session when you use the waithidden cmd.exe command, so your input does not carry over from one session to the next.

If you wanted to run multiple CLI commands at once, you can do this using the & operator; note that & will error out if the previous command failed, while && will process all of your commands regardless of exit state.

waithidden cmd.exe /c command 1 && command 2

Note that you need to invoke either /c or /k when running cmd.exe, at least in my experience.

That being said, in this case you can use the __Download relevance substitution instead of CD’ing to the folder. Simply run

waithidden cmd.exe /c __Download\AFUWIN.EXE APP.CAP /p /r

This of course presumes that the AFUWIN.exe resides in the Download folder.

1 Like

I was try, but the exe run without the parameters /p /r

That’s usually a command issue; you can try wrapping the parameters in quotes

waithidden cmd.exe /c __Download\AFUWIN.EXE “APP.CAP /p /r”

but I would always suggest you run the action through Fixlet Debugger with wait and cmd.exe /k to see what cmd.exe actually executes

wait cmd.exe /k __Download\AFUWIN.EXE APP.CAP /p /r

Just remember to not use wait and /k in your production action, or you’ll spawn a visible command window on your target estate :slight_smile:

Remember, each invocation of cmd.exe knows nothing of preceding or following invocations, so in your example the second one does not inherit the current directory that was set for the first.
You do need to test using the debugger and if a command needs to have the working directory explicitly set you need to look at running a small batch file (that you can either cache on the server and download or create on the fly in the actionscript).

1 Like

If APP.CAP is a file also in the __Download folder, then I think the command should be:

waithidden cmd.exe /c /s "__Download\AFUWIN.EXE __Download\APP.CAP /p /r"

You may need to pass the absolute path, with escaped quotes to the EXE, in which case it would be something like:

waithidden cmd.exe /c /s "__Download\AFUWIN.EXE \"{ pathname of download file "APP.CAP"}\" /p /r"

Let me know if either of these work.