日記帳
本ページはプロモーションが含まれています
カテゴリー
Links
blog(ブログ)マスター
アンドロイドの巣
ゼロから始めるベランダ菜園
タイトル
ラジコン
2024年5月
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

コマンドプロンプトから git bashコマンドを実行するには?

2024-04-12 09:41
タイトル

執筆:2024.04.12
編集:2024.04.12




手順

(1) コマンドプロンプトを起動します

(2) 重要: コードページのデフォルトがシフトジスなのでをUTF8に変更します。

(3) git bashを呼び出します。

バッチファイルの場合は、utf8でファイルを保存します。

@rem CODE PAGE UTF-8
chcp 65001

"C:\Program Files\Git\bin\bash.exe" --login -i -c "bash内の実行したいunixコマンド"


用途例

タスク(cron) と組み合わせるとリポジトリの自動更新ができます
バッチファイルに入れておいたほうが、マシンを変更したときや修正したいときに便利です。

1行にするには、 && でつなげます。

最初からフォルダ移動していたほうがいいかもですね.

chcp 65001 && chdir "パス" && "C:\Program Files\Git\bin\bash.exe" --login -i -c "bash内の実行したいunixコマンド"



-c
If the -c option is present, then commands are read from the first non-option argument command_string. If there are arguments after the command_string, the first argument is assigned to $0 and any remaining arguments are assigned to the positional parameters. The assignment to $0 sets the name of the shell, which is used in warning and error messages.


-i 対話的

If the -i option is present, the shell is interactive.




ブログ内 関連記事: コマンドプロンプトから git bashコマンドを実行するには?


ブログ内 関連記事: コマンドプロンプトから git bashコマンドを実行するには?

トラックバック
トラックバックはありません。
PR

[PR]