简体   繁体   中英

Pipe delimiter in .bat file

I am trying to export a table from BigQuery to Google CLoud Storage (GCS) using bq command in a bat file. The command has a parameter to export as a Pipe delimited file. The command works from the CLI as it is but when I run from a bat file using the call command it opens the command but does not execute it. Note: Same operation runs without the pipe delimiter parameter.

Any idea why?

call bq extract -F^^^| my-project:my-dataset.mytable gs://myfolder/myfile.csv

This is the only line I have in my bat file. when I run from command line it works:

C:\bq extract -F^^^| my-project:my-dataset.mytable gs://myfolder/myfile.csv

Output:

Waiting on bqjob_r01419067_00000169eed1d868_1 ... (0s) Current status: DONE

When I run the bat file, C:\\test.bat

Output:

C:\\bq extract -F^| my-project:my-dataset.mytable gs://myfolder/myfile.csv C:\\

IF Jeb's solution is correct you should be able to change your batch file code to this.

set "caret=^"
call bq extract -F"%%CARET%%|" my-project:my-dataset.mytable gs://myfolder/myfile.csv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM