Help with error 'The given path's format is not supported.'

Executing PowerShell script file from a batch file. The batch file creates 2 variables which are passed to the PowerShell script.
(Get-Content -Raw -Path $FileIn) -replace “(?<!r)n”,“rn” | Set-Content -Path $FileOut

Complete error msg:
Processing -File ‘‘f:\scripts\unix2dos2.ps1’ -filein ‘f:\temp\SD_SACD_SDSUID.csv’ -fileout ‘f:\Oracle\oradata\SD_SACD_SDSUID.csv’’ failed: The given path’s format is not supported. Specify a valid path for the -File parameter.

Cmd to run PowerShell in batch is:

powershell.exe -file “‘f:\scripts\unix2dos2.ps1’ -filein ‘%fnfive%’ -fileout ‘%fnsix%’”

Any thoughts?

You misplaced your double quote it should be
powershell -File “C:\Path\To\Script” -filein ‘%fnfve%’ etc

1 Like

That helped, but now it looks like PS is not resolving the parameter -filein %fnfive% correctly. The error is:

Get-Content : Cannot find path ‘F:\scripts'SD_SACD_SDSUID.csv’’ because it does not exist.
At F:\scripts\unix2dos2.ps1:7 char:2

  • (Get-Content -Raw -Path $FileIn) -replace “(?<!r)n”,“rn” | Set-Co …
  •  + CategoryInfo          : ObjectNotFound: (F:\scripts\'SD_SACD_SDSUID.csv':String) [Get-Content], ItemNotFoundExce
     + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

I would double check what you’re passing in from the bat file