Wrap bat file commands in a custom action (Action Script)

(imported topic written by RobertDiRosato)

Say I’m in the BigFix Console

Click Tools > Take Custom Action

I was told from the last TAB (Action Script) I can insert Bat file commands if I wrapped it right…

Say I wanted to add this to a Custom Actions… Action Script

md c:\test

copy c:\rob.txt c:\test

What would be the proper code to put in the action script to get that to run.

(What would I need before and/or after the bat commands)

I know this could be done in other ways… but I want to take advantage of the bat files I already have created…

Don’t wanna re-invent the wheel if I don’t have to…

Thanks in advance.

(imported comment written by jeremylam)

You can use the createfile command, which creates a file called “__createfile” and then use waithidden to run the batch file:

code

delete __createfile

createfile until END

md c:\test

copy c:\rob.txt c:\test

END

delete mynewfile.bat

move __createfile mynewfile.bat

waithidden mynewfile.bat >> mynewfile.log 2>&1

code

(imported comment written by RobertDiRosato)

That will work… Thanks

Is that the way you would run a bat in an action? or is there another way?

(imported comment written by jeremylam)

There are a few other ways - run, runhidden, wait, waitdetached, etc.

The Action Script reference is here: http://support.bigfix.com/fixlet/documents/WinActions_81_110817.pdf

Read the section entited “The Action Commands / Execution Commands” starting on page 11.