4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ヒアドキュメントを使ってコマンドに値を渡す(バッチファイル)

Last updated at Posted at 2020-08-20

はじめに

バッチファイルでヒアドキュメントを使ってコマンドに値を渡す方法

bash スクリプト

Linux で以下のようなコマンドを実行していたものを Windows のバッチファイルで実現する方法を探していたらできたので記載しておく

<コマンド>  <コマンド引数> <<EOF
<ユーザ名>
<パスワード>
<その他>
EOF

バッチファイル

以下のようにするとヒアドキュメントっぽくコマンドに値を渡すことができる

(
echo <ユーザ名>
echo <パスワード>
echo <その他>
) | <コマンド> <コマンド引数>
4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?