Executing a bat file which resides on another server

  • Hi,

    I have a task which I need to perform within a SSIS package. The task is to execute a .bat file. The .bat file resides on a different server from where the SSIS package is run. The process fails without any error details.

    I have searched through the web and the general opinion is to use an 'Execute Process Task'.

    I have set the Execuable setting to c:\windows\system32\cmd.exe

    and have set the Arguments setting to "/c \\ServerName\AX\WT A to B\Mileage.Bat".

    I'm not sure whether the '/c' should be within the double quotes. Maybe I need to add additional switches.

    Any ideas please?

    Thanks in advance

  • I have not used but it seems to me that you need to return a status from the bat file in order for the task to know if the bat succeeded or failed.

  • I think you need to surround the path with double quotes because it has a space in it...something like this:

    /c "\\ServerName\AX\WT A to B\Mileage.Bat"

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Thanks for the replies

    I realise that the code in my original posting needed double quotes

    "\\ServerName\AX\WT A to B\Mileage.Bat"

    I'm not sure whether the '/c' should be within the double quotes.

    I think I need to know whether this will work across servers and how to accomplish it.

  • DerbyNeal (5/13/2011)


    Thanks for the replies

    I realise that the code in my original posting needed double quotes

    "\\ServerName\AX\WT A to B\Mileage.Bat"

    I'm not sure whether the '/c' should be within the double quotes.

    I think I need to know whether this will work across servers and how to accomplish it.

    When you say "across servers" do you mean to execute on the server running the SSIS package or on the remote server where the bat file resides?

    If the latter then you're not om the right track. You'll want to look into something like PsExec.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply