INVOKE POWERSHELL VARIABLE PASSING

Hello Guys I want to convert a csv file from CRLF format to UNIX(LF) format and i preferred power shell for converting the format

Power Shel Script

$in = “C:\Users\Desktop\GL_B103_09_27_2022_11_09.csv”
$out =“C:\Users\Desktop\HO_PROCE\GL_B103_09_27_2022_11_09.csv”
(Get-Content $in) -join “`n” > $out

The problem is that the path of this file will change for every run since the path include timestamp
so i does anyone know how to pass a variable to the powershell script.

This is the code that i have developed

Powershell1

This is the powershell variable that i created to pass it to the powershell script

This is how i passed the variable to the powershell script

POWERSHELL3

And it it throwing error like

powershell4

Does anyone have the solution for this.

@Gokul_Murali you have powershell script and you want to add paths in it?
am i right?

Store powershell script like this in String Variable

->ScriptString=“$in = “{0}”
$out =“{1}”
(Get-Content $in) -join “`n” > $out”

then use

->String.Format(ScriptString, path1, path2)

use ScriptString in powershell activity

SINCE THE PATH IS CHANGING FOR EVERY RUN WE CAND HARDCODE THE PATH SO I WANT TO PASS THE PATH AS A VARIABLE

@Gokul_Murali Store Script like my suggestion. and put variable in it through String. Format.
Its a dynamic procedure.

powershell5

still error is throwing

do i need to put “path1” and “path2” instead of {0} and {1}

Hi @Gokul_Murali
I am sending you sample code. Maybe you get help from it.

Ok thankyou

@Gokul_Murali
please check.
how I am making dynamic

PowerShellCommand.xaml (5.8 KB)
Untitled1.txt (73 Bytes)

Hello @Gokul_Murali

Please check the below.

Thanks

@Gokul_Murali I have upodated post now text file is available. you can check