Hi developer,
Here is my sample script:
Get-Content .\Test.txt | ForEach-Object{$_ -replace “\s+”,“,”} | Out-File -FilePath Test.csv -Encoding OEM
It is ok as above the script.
Now i am going to change of my logic script as below:
$File = .\Test.txt
$BaseName = $File.BaseName
Get-Content $File | ForEach-Object{$_ -replace “\s+”,“,”} | Out-File -FilePath $BaseName.csv -Encoding OEM
it does not work and how to get file name or base name (Test) without extension?
Any idea?
Thanks