DOSCMD        Execute an internal MS-DOS command

Top  Previous  Next

Syntax:

DOSCMD

[ cmd ]

Arguments:

[ cmd ]

Variable or string defining an MS-DOS command such as dir, copy, mkdir, etc. to be executed.

Options:

/timeout=x

Number of seconds to wait for the command to complete.  When no timeout is specified Robo-FTP will wait indefinitely.

 

 

This script command executes a specified MS-DOS internal command. Robo-FTP is suspended until the execution of the command is complete.

 

Consider the following example that runs a batch file.

 

DOSCMD "DoSomething.bat"

 

Consider the following example that lists the contents of the current folder to a file.

 

DOSCMD "dir *.* > tempfile"

 

Consider the following example where a new folder is created and the contents of the current folder is copied there.

 

DOSCMD "mkdir \newfolder"

DOSCMD "copy *.* \newfolder"

 

Upon return, any exit code from the process launched with DOSCMD is saved in the %lasterror script variable and can be tested with any of the IFERROR commands. For example:

 

DOSCMD "fc file1.txt file2.txt"

;; ‘fc’ returns 2 if it cannot compare the specified files

IFERROR= 2 GOTO fc_error

 

The /timeout option allows you to specify the maximum amount of time to wait for the command to complete.  This option is useful for protecting your command script from an unreliable command.  If you do not specify a timeout and the command hangs waiting for user input (ie: Abort, Retry, Fail?) then Robo-FTP will also wait indefinitely.

 

 

Related Command(s): EXEC, CALL, CHAIN

See also: Script File Result Codes