PowerShell script task fails when using single quotes in arguments in Bamboo

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Low
    • None
    • Affects Version/s: 10.2.2
    • Component/s: Tasks, Windows
    • None
    • 2
    • Severity 3 - Minor

      Issue Summary

      PowerShell script task fails when using single quotes in arguments after the Bamboo 10.2.2 upgrade.

      Steps to Reproduce

      1. Link the repository and create a Plan.
      2. Add a Job with two tasks:
        • Task 1: Checkout
        • Checkout repo into a defined working directory (e.g., test).
        • Task 2: Script Task
        • Interpreter: Windows PowerShell
        • Script Location: File
        • Script file: script1.ps1
        • Arguments: -ScriptPath '.\script2'
        • Working Subdirectory: Same as the checkout directory
      3. Run the Plan

      Expected Results

      The task should execute without any errors

      Actual Results

      The build is failing with the below error in the build logs:

      error	01-Apr-2025 07:44:19	C:\Users\Administrator\bamboo-agent-home\xml-data\build-dir\PROJ-BAN2-JOB1\test\script1.ps1 : Script not found at path: 
      error	01-Apr-2025 07:44:19	''.\script2.ps1''
      error	01-Apr-2025 07:44:19	    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
      error	01-Apr-2025 07:44:19	    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,run.ps1
      error	01-Apr-2025 07:44:19	 
      

      Workaround

      Replace the single quotes with double quotes.

            Assignee:
            Unassigned
            Reporter:
            Mohamed Ayman (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: