Powershell Command within batch file issues

Hello Folks -

 

I hope all is well! I have the following powershell code within a ps1 script that is working just fine:

import-csv FINIQOPEN_Apr.csv -Delimiter '|' | select 'Projected Start Date' | % { 
    Write-Host "$_ $([string]::IsNullOrEmpty($_.'Projected Start Date'))"
    if ( $([string]::IsNullOrEmpty($_.'Projected Start Date')) )
        {
            exit 1
        }
}

However, I want to be able to execute the code directly within batch. I was able to get it to execute, however it’s not recognizing my exit command:

powershell -ExecutionPolicy ByPass -command "&{"^
    "import-csv FINIQOPEN_Apr.csv -Delimiter '|' | select 'Projected Start Date' | foreach-object {"^
        "Write-Host "$_ $([string]::IsNullOrEmpty($_.'Projected Start Date'))""^
            "if ( $([string]::IsNullOrEmpty($_.'Projected Start Date')) )"^
                "{"^
                    "exit 1"^
                "}"^
    "}"^
 "}"

What am I doing wrong? Thank you!

What is the ^ here ? Can you try saving this as a ps1 file and call that ps1 via batch file.

What is the ^ here ? Can you try saving this as a ps1 file and call that ps1 via batch file.