Windows のコマンドラインからバッチファイルを実行する方法

Windows のコマンドラインからバッチファイルを実行する方法

このwikiHowでは、Windowsのコマンドラインを使用してバッチファイル(.BAT)を実行する方法を説明します。 「実行」ダイアログボックスまたは「ターミナル」ウィンドウにコマンドを入力してプログラムを実行できます。

方法1方法1/2:

実行ダイアログボックスの使用

  1. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/b\/be\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-1.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-1.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/b\/be\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-1.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-1.jpg","smallWidth":460,"smallHeight":346,"bigWidth":728,"bigHeight":547,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 1Win + Rキーの組み合わせを押して、「実行」ダイアログボックスを開きます。
    • 管理者としてバッチ ファイルを実行する必要がある場合は、この方法を参照してください。
  2. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/9\/94\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-2.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-2.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/9\/94\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-2.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-2.jpg","smallWidth":460,"smallHeight":343,"bigWidth":728,"bigHeight":543,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 2クリックして参照します
  3. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/a\/a0\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-3.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-3.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/a\/a0\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-3.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-3.jpg","smallWidth":460,"smallHeight":351,"bigWidth":728,"bigHeight":555,"licensing":" class=\"mw-parser-output\"><\/div>"} 3バッチファイルが保存されているフォルダーに移動します。
  4. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/6\/6a\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-4.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-4.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/6\/6a\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-4.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-4.jpg","smallWidth":460,"smallHeight":348,"bigWidth":728,"bigHeight":550,"licensing":" class=\"mw-parser-output\"><\/div>"} 4バッチファイルをクリックして選択すると、強調表示されます。
  5. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/b\/b5\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-5.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-5.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/b\/b5\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-5.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-5.jpg","smallWidth":460,"smallHeight":348,"bigWidth":728,"bigHeight":550,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 5クリックして開きますこれにより、バッチ ファイルへの完全なパスが [実行] ダイアログ ボックスに貼り付けられます。
  6. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/7\/7c\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-6.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-6.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/7\/7c\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-6.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-6.jpg","smallWidth":460,"smallHeight":347,"bigWidth":728,"bigHeight":549,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 6 「OK」をクリックします。 「ターミナル」ウィンドウでバッチファイルを開き、プログラムを実行します。実行が終了すると、ウィンドウの下部に「続行するには任意のキーを押してください」という行が表示されます。
  7. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/1\/17\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-7.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-7.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/1\/17\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-7.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-7.jpg","smallWidth":460,"smallHeight":342,"bigWidth":728,"bigHeight":541,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 7コマンドを実行した後、任意のキーを押して「ターミナル」ウィンドウを閉じます。広告する
方法2方法2/2:

ターミナルウィンドウを使用する

  1. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/e\/e0\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-8.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-8.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/e\/e0\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-8.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-8.jpg","smallWidth":460,"smallHeight":342,"bigWidth":728,"bigHeight":542,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 1クリック{"smallUrl":"https:\/\/www.wikihow.com\/images_en\/0\/07\/Windowsstart.png","bigUrl":"https:\/\/www.wikihow.com\/images\/thumb\/0\/07\/Windowsstart.png\/30px-Windowsstart.png","smallWidth":460,"smallHeight":460,"bigWidth":30,"bigHeight":30,"licensing":"<div class=\"mw-parser-output\"><\/div>"}スタート メニュー。通常は画面の左下隅にあります。
  2. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/5\/5b\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-9.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-9.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/5\/5b\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-9.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-9.jpg","smallWidth":460,"smallHeight":341,"bigWidth":728,"bigHeight":540,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 2検索バーに「cmd」と入力すると、一致する検索結果が一覧表示されます。
  3. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/9\/99\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-10.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-10.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/9\/99\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-10.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-10.jpg","smallWidth":460,"smallHeight":344,"bigWidth":728,"bigHeight":544,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 3 コマンドプロンプトを右クリックします。メニューが展開されます。
  4. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/2\/22\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-11.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-11.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/2\/22\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-11.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-11.jpg","smallWidth":460,"smallHeight":344,"bigWidth":728,"bigHeight":545,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 4「 管理者として実行」をクリックします。確認メッセージが表示されます。
  5. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/d\/dd\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-12.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-12.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/d\/dd\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-12.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-12.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 5 「OK」をクリックします。最高権限(管理者)でコマンド ラインを開きます。
  6. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/3\/34\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-13.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-13.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/3\/34\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-13.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-13.jpg","smallWidth":460,"smallHeight":343,"bigWidth":728,"bigHeight":543,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 6 CD ファイルとバッチ ファイルの完全なパスを入力します。例えば:
    • ファイルがデスクトップにある場合は、 cd \Users\ログイン名\Desktopと入力します。
    • ダウンロード フォルダーにいる場合は、 cd \Users\ログイン名\Downloadsと入力します。
    • ログイン名がわからない場合は、 「cd \Users」と入力してEnter キーを押してUsers フォルダーに移動し、 「dir」と入力してEnter キーを押してログインの一覧を表示します。
  7. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/4\/4d\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-14.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-14.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/4\/4d\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-14.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-14.jpg","smallWidth":460,"smallHeight":342,"bigWidth":728,"bigHeight":541,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 7 Enter キーを押してディレクトリに入ります。
  8. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/0\/00\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-15.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-15.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/0\/00\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-15.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-15.jpg","smallWidth":460,"smallHeight":346,"bigWidth":728,"bigHeight":547,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 8バッチファイルの名前を入力します。ファイル名が「program.bat」の場合は、「 program.bat 」と入力します。
    • 名前がわからない場合は、 「dir」と入力してEnter キーを押して、フォルダー内のファイルを参照します。ここでファイル名を確認できます。
  9. {"smallUrl":"https:\/\/www.wikihow.com\/images_en\/thumb\/3\/35\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-16.jpg\/v4-460px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-16.jpg","bigUrl":"https:\/\/www.wikihow.com\/i mages\/thumb\/3\/35\/Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-16.jpg\/v4-728px-Run-a-Batch-File-from-the-Command-Line-on-Windows-Step-16.jpg","smallWidth":460,"smallHeight":342,"bigWidth":728,"bigHeight":541,"licensing":"<div class=\"mw-parser-output\"><\/div>"} 9Enter キーを押してバッチ ファイルを実行します。広告する

<<:  ペニスに性感染症の兆候がないかチェックする方法

>>:  排水溝のハエを駆除する方法

推薦する

彼女がもうあなたを好きではないかどうかを知る方法

彼女との関係が危機に瀕していると感じたら、関係における特定の警告サインを探し、彼女があなたに対してど...

ストリートファイトに勝つ方法

この記事の目的は、理由もなく外に出て他の人と喧嘩をすることを勧めるのではなく、路上での喧嘩から無傷で...

Windows 8.1 を無料でアクティベートする方法

Windows 8.1 を初めて使用する場合は、続行する前に少し時間を取ってアクティブ化する必要があ...

コスト削減の計算方法

価格がどの程度の割引または値上げを表すかを判断するには、コスト削減率を計算する必要があります。 [1...

透明で滑らかな肌を手に入れる方法

肌荒れや乾燥に悩んでいませんか?あなたの肌はニキビやアレルギーになりやすいですか?幸いなことに、肌を...

脚本の書き方

あなたは次のウィリアム・シェイクスピアかチャーリー・カウフマンでしょうか?さあ、あなたの才能を証明す...

新しいコンピュータにオペレーティング システムをインストールする方法

このwikiHowでは、新品の空のコンピューターにオペレーティング システムをインストールする方法を...

BIOSをリセットする方法

最近コンピューターのハードウェアを変更し、BIOS をリセットする必要がありますか? BIOS パス...

妊娠を防ぐ方法

避妊方法にはさまざまな選択肢があるため、どれを選ぶべきか決めるのが難しい場合があります。それぞれの避...

目に入ったほこりを取り除く方法

目にほこりが入るというのはごく普通のことです。常に外出している場合、このようなことが起こる可能性が高...

夜間の手足のかゆみを和らげる方法

手足のかゆみは掻痒症とも呼ばれ、アレルギー性の発疹、乾癬、皮膚炎など、さまざまな皮膚疾患によって引き...

...

陸上競技の準備方法

陸上競技の競技に向けて準備しているアスリートから、レースで優勝を目指す初心者まで、経験の有無に関わら...

アーモンドオイルを髪に使う方法

アーモンドオイルには、オメガ3脂肪酸、リン脂質、ビタミンE、マグネシウムなど、髪の健康に有益なさまざ...

カーブボールの投げ方

カーブボールの正しい投げ方を知っておくと、腕や肩の怪我を防ぐことができます。ここに、従うべき技術的な...