Skip to content

Execute Native Commands

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
  • standman Offline
  • Posts: 4
  • Joined: Wed Aug 13, 2014 12:34 pm

Execute Native Commands

Post by standman »

I have a simple test project to delete a file using the windows cmd.exe command. I'm just trying to test out functionality and I can't get it to work. XML is below. Anyone using cmd.exe?

Code: Select all

<project name="test" mainModule="Main" version="2.0" logLevel="debug">

	<module name="Main">

		<createWorkspace label="Create Workspace" version="1.0" />


		<exec executable="C:\Windows\System32\cmd.exe" version="1.0">
			<arg value="del C:\temp\test.rtf" />
		</exec>


		<deleteWorkspace label="Delete Workspace" version="1.0" />

	</module>

</project>
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: Execute Native Commands

Post by Support_Rick »

Try this:

Code: Select all

<project name="Test CMD" mainModule="Main" version="2.0" logLevel="debug">

	<module name="Main">

		<createWorkspace label="Create Workspace" version="1.0" />

		<exec executable="C:\Windows\System32\Cmd.exe" version="1.0">
			<arg value="/k" />
			<arg value="Del C:\Temp\Test.rtf" />
		</exec>

		<deleteWorkspace label="Delete Workspace" version="1.0" />

	</module>

</project>
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • standman Offline
  • Posts: 4
  • Joined: Wed Aug 13, 2014 12:34 pm

Re: Execute Native Commands

Post by standman »

Rick, That worked. I've been going back and forth with support on this. Can you explain the use of the /k argument in the project? and will I need to call that prior to every argument or just before my list of arguments? Thanks in advance..
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: Execute Native Commands

Post by Support_Rick »

The /k argument is from the definition of the CMD.EXE

/k : Carries out the command specified by the string but remains active
/c : Carries out the command specified by the string and then terminates

If you are going to use the CMD.EXE, please review the Help Text on that command and it will further explain. Otherwise, you should be able to address the ERASE or DEL commands directly without having to call the CMD.EXE.

Another option is to create a BAT file that contains the commands you want to execute and then just call the BAT file from the EXEC Task.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • standman Offline
  • Posts: 4
  • Joined: Wed Aug 13, 2014 12:34 pm

Re: Execute Native Commands

Post by standman »

All good options, Thanks for your insight.
Post Reply