簡體   English   中英

如何在Windows中拆分長Linux命令

[英]How to split long Linux command up in Windows

我有一個在Linux上運行的python程序,帶有很多參數。 在Unix中,我使用\\分隔每一行。

如何在Windows中格式化這些相同的路徑?

這是我在Linux中使用的命令:

python -m bin.train \
  --config_paths="
      ./example_configs/nmt_small.yml,
      ./example_configs/train_seq2seq.yml,
      ./example_configs/text_metrics_bpe.yml" \
  --model_params "
      vocab_source: $VOCAB_SOURCE
      vocab_target: $VOCAB_TARGET" \
  --input_pipeline_train "
    class: ParallelTextInputPipeline
    params:
      source_files:
        - $TRAIN_SOURCES
      target_files:
        - $TRAIN_TARGETS" \

我想在Windows中執行此操作。 如何在一行中做到這一點(或者)我可以簡單地保持原樣並運行它?

作為引用在這里 ,在Windows命令行可以單獨一個長行成多行與“^” ^操作符:

例如。

python -m bin.train ^
  --config_paths="
      ./example_configs/nmt_small.yml,
      ./example_configs/train_seq2seq.yml,
      ./example_configs/text_metrics_bpe.yml" ^
  --model_params "
      vocab_source: $VOCAB_SOURCE
      vocab_target: $VOCAB_TARGET" ^
  --input_pipeline_train "
    class: ParallelTextInputPipeline
    params:
      source_files:
        - $TRAIN_SOURCES
      target_files:
        - $TRAIN_TARGETS" ^

打開記事本,將其全部寫在一行上,並以.bat擴展名保存。 您可以將其保存在任何地方,並在需要時運行它。

我天真的嘗試將其全部整合到這里:

python -m bin.train --config_paths="./example_configs/nmt_small.yml,./example_configs/train_seq2seq.yml,./example_configs/text_metrics_bpe.yml" --model_params "vocab_source: $VOCAB_SOURCE vocab_target: $VOCAB_TARGET" --input_pipeline_train "class: ParallelTextInputPipeline params: source_files: - $TRAIN_SOURCES target_files: - $TRAIN_TARGETS"

如果某種方式搞砸了,您可能可以解決它,我沒有上下文可以做得更好

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM