Search code examples
sql-serverssisetldtexec

Passing parameters to a package from command prompt


I have a ssis package "pkg1" with a variable "var1" which I pass a parameter to it from the command prompt such as

dtexec.exe /f c:\pkg1.dtsx /set \Package.Variables[User::var1].Properties[Value];"test"

In the packages I have a script task which I display the value of the variable

  MessageBox.Show(Dts.Variables["User::var1"].Value.ToString());

When I run this package from the command prompt. The messagebox opens but no value for my variable is displayed.


Solution

  • you are trying to pass a string value which need to be double quoted, you have to add \" at the beginning and the end of value

    dtexec.exe /f c:\pkg1.dtsx /set "\Package.Variables[User::var1].Value";\""test"\"