-1

I have multiline injection to 'psql' command in linux using EOF.

psql << EOF sql1 sql2

EOF

I want to do the same in windows powershell because(yes it's hard on me) we moved from linux to windows. I tried scriptblock, using psql as the block and commands as arguments. Wouldn't work. Please let me know how to simulate the EOF in Windows powershell. Google doesn't have much on this.

Arun Srini
  • 17
  • 1
  • 6

1 Answers1

1

PowerShell supports here-strings, though it doesn't support arbitrary delimiters. It also doesn't support standard input redirection by naming the command first and the input second -- you can only pipe input to the command. This should come closest to what you're doing:

@"
sql1
sql2
"@ | psql

Use single quotes rather than double quotes if you want to suppress variable substitution.

Jeroen Mostert
  • 27,176
  • 2
  • 52
  • 85