Custom dos BAT commands from SSIS

Posted on 2009-04-20
Last Modified: 2013-11-10
I have a need to run some custom DOS commands from an SSIS package. Normally I would use a .BAT file and just use the Execute process task. However this time I need to make these calls programmaticly - the parameters are changing, as well as a decryption key must be used that cant be in plain text.

i needto make two calls - one to GZIP to unzip a file and another to decrypt a file, for example

decrypt.exe -1 -2 -key "AbC$%{" FileName.enc Filename.Clear.gz
gzip Filename.Clear.gz Filename.Clear

The changing parameters here are the key and the filename - I would like to be ablke to specify these as SSIS package variables.. Can the script task in SSIS do something like a shell out to the OS, or is there a better way to handle this?

Question by:mikegrad7
    LVL 30

    Accepted Solution

    You can build your command line dynamically using an expression.
    1. Open the property page for the Execute Process Task
    2. Press the 'browse' button on Expressions property
    3. Pick the Executable property
    4. Enter or build an expression. This will be evaluated at run time and will replace the Executable property within the task.
    Post back with some more details on your variables and how they fit together and I can help you build an expression.
    LVL 1

    Author Comment

    Thanks nmcdermaid, i completey forgot about expressions - i hadn't tried that.  Can i put the whole expression, arguments and all, in the executable property, or do i still have to split it up and put the exe in the executable property and the arguments in the arguments property?.
    LVL 30

    Expert Comment

    I assume you can just put it all in the executable property. When you run it in DOS, its all on one line concatenated line. I think the arguments property is just an optional extra to make it 'neater'

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    Via a live example, show how to shrink a transaction log file down to a reasonable size.
    Via a live example, show how to setup several different housekeeping processes for a SQL Server.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now