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 キーを押してバッチ ファイルを実行します。広告する

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

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

推薦する

因数分解の方法

数学において、「因数分解」とは、数値または式を複数の数値または式の積に分解することを意味します。因数...

...

デスクトップの背景アルバムの背景画像を削除する方法

デスクトップの背景にはあなたの個性を反映させたり、お気に入りの写真を表示したりすることができます。設...

十代の若者の自尊心を効果的に高める方法

十代の若者には、実のところ多くの心配事が伴います。時々、すべての人や物事があなたに敵対しているように...

アパートのゴキブリを駆除する方法

ゴキブリにはさまざまな種類があります。あなたの家にどんな種類のネズミが現れたかに関係なく、あなたはお...

手についたハラペーニョのカプサイシンを除去する方法

ハラペーニョの中毒性のある辛さはカプサイシンによるもので、皮膚に灼熱感を引き起こす原因でもあります。...

交通カードの残高を確認する方法

ニューヨーク、アデレード、東京、ニュージーランドなどで地元の公共交通機関を利用する場合、乗車カードの...

年上の男性があなたに好意を持っているかどうかを知る方法

あなたは面白い年配の男性に出会いましたが、彼の態度が曖昧なのか友好的なのか分かりません。自分と同年代...

家庭内でのいじめに対処する方法

いじめを経験することは、特に家庭内で起こった場合には、苦痛で孤独な体験となることがあります。残念なが...

Appleマップの使い方

最近、Apple デバイス上の Google マップは Apple マップに置き換えられました。まだ...

カボチャを冷凍する方法

カボチャは生の角切り、調理済みの角切り、ピューレの形で冷凍できます。生のカボチャの角切りを冷凍するの...

天井のカビを除去する方法

天井はカビが生えていますか?カビは見た目が悪く不健康であるだけでなく、掃除するのも非常に困難です。ま...

ウォーキング運動の始め方

歩くことは私たちが毎日行う基本的な活動ですが、健康を維持するためには十分な運動をする必要があります。...

動物細胞と植物細胞の3Dモデルを作成する方法

科学の授業で植物や動物の細胞の 3D モデルを作成する必要がありますか? これは、いくつかの一般的な...

スペイン語で「愛しています」と書く方法

スペイン語で「愛しています」と書くには、主に 2 つの方法があります。1 つはロマンチックな愛を表現...