Search

Execute Process Task quote encloses variables used in expressions by mfearskp

Active

1
0
Sign in
to vote
Type: Bug
ID: 777329
Opened: 1/23/2013 4:35:45 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
Variables containing quotes in expressions are ultimately wrapped as a literal.

String variable
-File "C:\Development\KP Integration\KP Integration\ADExport.ps1" "C:\Test\ADUsers.csv"

Becomes
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-File "C:\Test\test.ps1" "C:\argument\path\test.csv"" at "".

Note the " injected before the -File value and at the end of the string.

Cannot use replace function due to dependencies on quotes to pass file path information to PowerShell.
Details (expand)

Product Language

English

Version

SQL Server 2008 R2 SP2 CTP

Category

Integration Services (DTS)

Operating System

Not Applicable

Operating System Language

US English

Steps to Reproduce

Create a new package.
Create a variable named ExecFile
Add a script component, set ExecFile variable as ReadWriteVariable
Replace the Main() method with this code.
        public void Main()
        {
            // TODO: Add your code here
            string filearg = "-File ";
            string path = filearg + @"""C:\Test\test.ps1""" + " " + @"""C:\argument\path\test.csv""";
            MessageBox.Show(path);
            Dts.Variables["Execfile"].Value = path;
            bool fireagain = false;
            Dts.Events.FireInformation(0, "", path, "", 0, ref fireagain);
            Dts.TaskResult = (int)ScriptResults.Success;
        }

1. Add an Execute Process Task
2. Set Executable to Powershell - C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
3. Go To Expression and add an expression for the Arguments property. Set this value to be the variable ExecFile.

Actual Results

Arguments passed to variable:
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-File "C:\Test\test.ps1" "C:\argument\path\test.csv"" at "".

Expected Results

Arguments passed to variable should be:
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -File "C:\Development\KP Integration\KP Integration\ADExport.ps1" "C:\Test\ADUsers.csv"

Platform

X64

Virtualization

 
File Attachments
File Name Submitted By Submitted On File Size  
Integration Services Project1.zip (restricted) 1/23/2013 -
Sign in to post a comment.
Sign in to post a workaround.