locked
how to set args[0] param in script task? RRS feed

  • Question

  • Happy New Year to everyone!

    I tried to run a console app with paramerters in args[0] in Script Task of SSIS. The function of the application is to read in a text file and check something inside. But in order to run the app where should I place that text file to be fed in? Thanks in advance.

     


    allan
    Monday, January 2, 2012 12:13 AM

Answers

  • Console applications can take parameters from command line console (check link below). Obviously that you can create a new process and pass the parameters (like Alexander wrote) but this way you'll have your code (console app) elsewhere.

    http://msdn.microsoft.com/en-us/library/452fz12a%28v=VS.90%29.aspx

    If you want to have your code in a script task then you should pass the parameters in the SSIS way (read/write variables) - like in the article I've posted before (search for "Using a Script Task instead").

    There's any problem doing things this way? If so, maybe you can give some more detail on your specific scenario.

    David.

    • Proposed as answer by Eileen Zhao Tuesday, January 3, 2012 8:04 AM
    • Marked as answer by Eileen Zhao Sunday, January 8, 2012 4:59 AM
    Monday, January 2, 2012 4:41 PM

All replies

  • Do you mean this for VB.net ?

     

                Dim SevenZip As New System.Diagnostics.Process
    			
                'Parameter fuer die 7z-Konsole
                zipArgumente = "a " + path + filename + ".zip " + filename2
    
                'Pfad zur 7z.exe
                SevenZip.StartInfo.FileName = "c:\Program Files (x86)\7-Zip\7z.exe"
                
                'Parameter fuer die 7z-Konsole
                SevenZip.StartInfo.Arguments = zipArgumente
    
                SevenZip.Start()
    
                SevenZip.WaitForExit()
    
    


     

     

     

    Monday, January 2, 2012 3:30 PM
  • Hi, a script in SSIS doesn't receive parameters like a Console application.

    Check this article on how to pass parameters to a script task in SSIS:

    http://www.simple-talk.com/sql/ssis/passing-variables-to-and-from-an-ssis-task/

    David.

    Monday, January 2, 2012 3:46 PM
  • Alex, vielen danke, aber das ist nicht was ich suche.
    Dac03, that's a good article but I did not see the author saying params can't be passed in a console app in Script task. Is there any official site to describe this? Thanks guys.

     

     


    allan
    Monday, January 2, 2012 4:31 PM
  • Console applications can take parameters from command line console (check link below). Obviously that you can create a new process and pass the parameters (like Alexander wrote) but this way you'll have your code (console app) elsewhere.

    http://msdn.microsoft.com/en-us/library/452fz12a%28v=VS.90%29.aspx

    If you want to have your code in a script task then you should pass the parameters in the SSIS way (read/write variables) - like in the article I've posted before (search for "Using a Script Task instead").

    There's any problem doing things this way? If so, maybe you can give some more detail on your specific scenario.

    David.

    • Proposed as answer by Eileen Zhao Tuesday, January 3, 2012 8:04 AM
    • Marked as answer by Eileen Zhao Sunday, January 8, 2012 4:59 AM
    Monday, January 2, 2012 4:41 PM