does Custom Tool really run a command?

Comments

4 comments

  • Brigg Angus

    Hi Mmuni,

    To answer your question, it does run a command, but more along the lines of Start > Run than invoking cmd.exe. To achieve the results you want from the above example, this should work:

    cmd.exe /c "Del /Q /S %systemroot%\Temp\*.*"
    0
    Comment actions Permalink
  • Michael Muni

    Ok, so I would need to add the cmd.exe /c and wrap it in quotes? I'm not deleting my temp folder but instead deleting the temp folder on the selected target machine.

    0
    Comment actions Permalink
  • Brigg Angus

    I think I misunderstood. To run it on any number of remote machines, you would use something like this, otherwise, yes, it would only run on the local machine:

    cmd.exe /c "Del /Q /S \\%TARGETHOSTNAME%\c$\Windows\Temp\*.*"

    You can test this by running a simple dir command with the /k switch:

    cmd.exe /k "dir \\%TARGETHOSTNAME%\c$\Windows\"

    EDIT:
    And if you wanted this to run the command on any number of machines or an entire collection, you could always use the Tools > Remote Command, and simply run the command (no need to invoke cmd.exe), Del /Q /S %systemroot%\Temp\*.*, which will run remotely on each selected machine.

    0
    Comment actions Permalink
  • Michael Muni

    works great, now I can get rid of all the Batch Files I created for custom tools.

    0
    Comment actions Permalink

Please sign in to leave a comment.