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.
5 posts Page 1 of 1

standman

Posts: 4
Joined: Wed Aug 13, 2014 12:34 pm

Post by standman » Mon Oct 27, 2014 4:22 pm
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

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Mon Oct 27, 2014 5:14 pm
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

Posts: 4
Joined: Wed Aug 13, 2014 12:34 pm

Post by standman » Tue Oct 28, 2014 10:31 am
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

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Tue Oct 28, 2014 10:48 am
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

Posts: 4
Joined: Wed Aug 13, 2014 12:34 pm

Post by standman » Tue Oct 28, 2014 10:58 am
All good options, Thanks for your insight.
5 posts Page 1 of 1