Calling BTEQ with file within PowerShell

Tools

Calling BTEQ with file within PowerShell

Hi,

Currently, I execute BTEQ scripts via a generated .Bat file with each script having a call to BTEQ similar to below:

bteq <Bteq\"File_1.btq" >> bteq_output.txt 2>&1

I am trying to create the same functionality but using PowerShell instead. The problem I am facing is the "<" character in the call. The BTEQ cmd line call to my knowledge, uses this to identify an input file. In PowerShell, this is an operator which with the following PowerShell command

(Get_Content -Path $configFile) | Select-Object -Skip 1 | ForEach-Object { bteq < (Join-Path $deployDir $_) >>bteq_output.txt }

Causes the following error:

+  ... ect { bteq.exe < (Join-Path $deployDir $_) >>bteq_output.txt }

+

The '<' operator is reserved for further use.

I have tried escaping the < with the PowerShell escape character ` to no avail. Either it has the < in the call which PowerShell doesn't like or any combination of input does not get picked up as an input parameter to the call for bteq to execute the script that I am trying to run.

Any help would be most appreciated.

Regards,

Jamie

1 REPLY
Enthusiast

Re: Calling BTEQ with file within PowerShell

Happened to me too I use the Powershell "cat" command

cat myfile.btq | bteq