<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>作り方 &#8211; スグブログ</title>
	<atom:link href="https://sugublog.org/tag/%E4%BD%9C%E3%82%8A%E6%96%B9/feed/" rel="self" type="application/rss+xml" />
	<link>https://sugublog.org</link>
	<description>ブログ運営について発信中</description>
	<lastBuildDate>Sun, 18 Feb 2024 10:46:42 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://sugublog.org/wp-content/uploads/2021/07/icon_20210703-min-150x150.png</url>
	<title>作り方 &#8211; スグブログ</title>
	<link>https://sugublog.org</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>バッチファイル（bat）の作り方！初心者でも簡単に作成できます！</title>
		<link>https://sugublog.org/bat-file-how-to-create/</link>
					<comments>https://sugublog.org/bat-file-how-to-create/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[suguru]]></dc:creator>
		<pubDate>Wed, 27 Dec 2023 14:08:16 +0000</pubDate>
				<category><![CDATA[bat]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[作り方]]></category>
		<guid isPermaLink="false">https://sugublog.org/?p=6168</guid>

					<description><![CDATA[<p><img src="https://sugublog.org/wp-content/uploads/2021/07/PC007-9-1024x717.jpg" class="webfeedsFeaturedVisual" /></p>バッチファイル（bat）の作り方を教えます。 windowsの端末やサーバーを扱う時にバッチファイルを理解していればメリットが沢山あります。 そこでwindowsで初心者を脱する為に、まずはバッチファイルの作り方を覚えま [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img src="https://sugublog.org/wp-content/uploads/2021/07/PC007-9-1024x717.jpg" class="webfeedsFeaturedVisual" /></p>
<p><strong><span class="swl-inline-color has-swl-deep-01-color"><span class="swl-fz u-fz-l">バッチファイル（bat）の作り方</span></span></strong>を教えます。</p>



<p>windowsの端末やサーバーを扱う時に<strong>バッチファイル</strong>を理解していればメリットが沢山あります。</p>



<p>そこでwindowsで初心者を脱する為に、まずはバッチファイルの作り方を覚えましょう！</p>


<div class="swell-block-balloon"><div class="c-balloon -bln-right" data-col="red"><div class="c-balloon__icon -square"><img decoding="async" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="https://sugublog.org/wp-content/uploads/2021/02/mine_white_002-e1624111291945.png" alt="" class="lazyload c-balloon__iconImg" width="80px" height="80px"><noscript><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/02/mine_white_002-e1624111291945.png" alt="" class="c-balloon__iconImg" width="80px" height="80px"></noscript><span class="c-balloon__iconName">管理人</span></div><div class="c-balloon__body -speaking -border-on"><div class="c-balloon__text">
<p>バッチファイルを作る上で<span class="swl-bg-color has-swl-deep-01-background-color">注意点</span>なども含めて教えます。</p>
<span class="c-balloon__shapes"><span class="c-balloon__before"></span><span class="c-balloon__after"></span></span></div></div></div></div>

<div class="p-blogParts post_content" data-partsID="5030">
<p>windowsのプロンプトで使用できるbatやpythonやphpを使用して、業務効率化やWebサイトを作成しております。javaやシェルスクリプトなど、様々なプログラミングを行った実績ありの筆者です。</p>
</div>


<p>この記事を読むと<strong><span class="swl-inline-color has-swl-deep-01-color"><span class="swl-fz u-fz-l">バッチファイルの作り方</span></span></strong>を学べて、<span class="swl-marker mark_orange">windowsでの初心者を脱する事が出来ます！</span></p>


<div class="swell-block-balloon"><div class="c-balloon -bln-left" data-col="blue"><div class="c-balloon__icon -square"><img decoding="async" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="https://sugublog.org/wp-content/uploads/2021/03/dog004-150x150.jpeg" alt="" class="lazyload c-balloon__iconImg" width="80px" height="80px"><noscript><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/03/dog004-150x150.jpeg" alt="" class="c-balloon__iconImg" width="80px" height="80px"></noscript><span class="c-balloon__iconName">機嫌のいいワンコ</span></div><div class="c-balloon__body -speaking -border-on"><div class="c-balloon__text">
<p>業務の幅も広がるので、是非バッチファイルの作り方を覚えて便利にwindowsを使えるようになりましょう！</p>
<span class="c-balloon__shapes"><span class="c-balloon__before"></span><span class="c-balloon__after"></span></span></div></div></div></div>

<div class="swell-block-balloon"><div class="c-balloon -bln-right" data-col="green"><div class="c-balloon__icon -square"><img decoding="async" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="https://sugublog.org/wp-content/uploads/2021/02/mine_white_002-e1624111291945.png" alt="" class="lazyload c-balloon__iconImg" width="80px" height="80px"><noscript><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/02/mine_white_002-e1624111291945.png" alt="" class="c-balloon__iconImg" width="80px" height="80px"></noscript><span class="c-balloon__iconName">管理人</span></div><div class="c-balloon__body -speaking -border-on"><div class="c-balloon__text">
<p>そうする事で単価も上がり、<span class="swl-bg-color has-swl-deep-03-background-color">エンジニアとしての価値も上げる事も可能</span>です。</p>
<span class="c-balloon__shapes"><span class="c-balloon__before"></span><span class="c-balloon__after"></span></span></div></div></div></div>


<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9330904718533231"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-format="autorelaxed"
     data-ad-client="ca-pub-9330904718533231"
     data-ad-slot="8455594968"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<h2 class="wp-block-heading">バッチファイル（bat）の作り方！</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" width="1024" height="683" src="https://sugublog.org/wp-content/uploads/2021/08/school_08-2-1024x683.jpg" alt="メモ帳でバッチファイル作成可能" class="wp-image-4088" srcset="https://sugublog.org/wp-content/uploads/2021/08/school_08-2-1024x683.jpg 1024w, https://sugublog.org/wp-content/uploads/2021/08/school_08-2-300x200.jpg 300w, https://sugublog.org/wp-content/uploads/2021/08/school_08-2-768x512.jpg 768w, https://sugublog.org/wp-content/uploads/2021/08/school_08-2.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p><strong><span class="swl-inline-color has-swl-deep-01-color"><span class="swl-fz u-fz-l">バッチファイル（bat）の作り方</span></span></strong>はメモ帳があれば作成可能です。</p>



<p>メモ帳でテキストファイルを開いて、バッチの中身を記述します。</p>



<p>保存する時に<span class="swl-marker mark_orange">識別子を「.txt」から「.bat」にすればバッチファイルを作る事が可能</span>です。</p>



<p>テキストファイルの識別子をそのまま「.bat」に変更してもOKです。</p>



<h2 class="wp-block-heading">バッチファイル（bat）の作り方で注意する事</h2>



<p><span class="swl-bg-color has-swl-deep-01-background-color">注意点</span>としては<span class="swl-marker mark_yellow">文字コードを「ANSI」</span>にする事です。</p>



<p>そうしないと日本語が文字化けする可能性があります。バッチファイルを実行して日本語が文字化けする場合は文字コードを確認してください。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/06/kaizen1-2-min-scaled.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-garbled-japanese-characters/">【bat】バッチファイルで日本語が文字化けする原因と解決策</a>
						<span class="p-blogCard__excerpt">バッチファイルを使用していて日本語が文字化けする時はないでしょうか？ その原因と解決策を現役エンジニアの筆者が教えます。一瞬で簡単にできるので試してください。&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h2 class="wp-block-heading">バッチファイル（bat）の記述で必須のコマンド</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" width="1024" height="683" src="https://sugublog.org/wp-content/uploads/2021/11/programing_1122-6-1024x683.jpg" alt="必須項目" class="wp-image-4563" srcset="https://sugublog.org/wp-content/uploads/2021/11/programing_1122-6-1024x683.jpg 1024w, https://sugublog.org/wp-content/uploads/2021/11/programing_1122-6-300x200.jpg 300w, https://sugublog.org/wp-content/uploads/2021/11/programing_1122-6-768x512.jpg 768w, https://sugublog.org/wp-content/uploads/2021/11/programing_1122-6.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<h3 class="wp-block-heading">バッチファイルを作り方でまず記述するコマンド</h3>



<p>バッチファイル（bat）の記述のやり方でまず初めの行に記述するものは「@echo off」というコマンドです。</p>



<p class="is-style-icon_info">このコマンドの意味は実行中のコマンドを非表示にします。</p>



<p>バッチファイルを実行すればわかりますが、このコマンドがないと実行するコマンドまで表示されて実行結果が見にくくなります。</p>



<p><span class="swl-inline-color has-swl-deep-03-color"><span class="swl-marker mark_green">バッチファイルを作成したら1行目に「@echo off」というコマンドを記述する</span></span>と覚えておきます。おまじないのようなものと考えて良いです。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/12/PC教室20211216-8-300x229.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-echo-off/">【bat基礎】バッチで「@echo off」の意味や効果とは？</a>
						<span class="p-blogCard__excerpt">batファイルの初めに「@echo off」という記載があると思いますが、この意味は何でしょうか？ なんの効果があるのでしょうか？「@echo off」が無ければどうなるのでしょ&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h3 class="wp-block-heading">バッチファイル（bat）でコメントアウトする</h3>



<p>次にバッチファイル（bat）を記述する上で必要な事として<span class="swl-inline-color has-swl-deep-01-color"><strong><span class="swl-fz u-fz-l">コメントアウト</span></strong></span>があります。</p>



<p class="is-style-icon_info">コメントを入れるメリットは未来の自分や他の人が見てわかりやすくする事です。</p>



<p>複雑なバッチファイルで内容を忘れた頃にメンテナンスする時や、人と共同で作業する時に必要になります。</p>



<p>コメントアウトのやり方はいくつかありますが、基本は<span class="swl-inline-color has-swl-deep-03-color"><span class="swl-marker mark_green">行はじめに「REM」を入れる事</span></span>で可能です。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/07/analytics-6-300x200.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-rem-meen-and-use/">【bat基礎】remの意味と使い方を教えます！初心者向けの記事になります！</a>
						<span class="p-blogCard__excerpt">batファイルでremという文字を見かけるけど、どういった意味があるのでしょうか？ どのような時に使用するのでしょうか？使い方は？ といった疑問の声がありましたので&#8230;</span>					</div>
				</div>
			</div>
		</div>


<p class="is-style-icon_pen">その他のコメントアウトのやり方は以下の記事を参照ください。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/07/PC007-8-300x182.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-commentout/">【bat基礎】バッチファイルでコメントアウトする方法！【エラー対処法有り】</a>
						<span class="p-blogCard__excerpt">batファイルでコメントアウトしたい場合の方法を記入します。 スクリプトを作成する上でコメントアウトは大事ですよね。後から見たら何をしているのかわからなくなった&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h3 class="wp-block-heading">バッチファイル（bat）で一時停止する</h3>



<p>次に必要なのが<strong><span class="swl-inline-color has-swl-deep-01-color"><span class="swl-fz u-fz-l">バッチファイルの処理を一時停止</span></span></strong>する事です。「PAUSE」コマンドで可能です。</p>



<p>バッチファイルの中身の上から下へ処理を行い、終われば自動的にプロンプトが閉じて終了します。</p>



<p class="is-style-icon_info">途中まで処理してとめたい場合や、プロンプトに結果を表示して確認したい場合には一時停止して確認します。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/09/jump0907-3-300x225.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-base-pause/">【bat基礎】バッチでPAUSEを使用して一時停止する！waitはありません</a>
						<span class="p-blogCard__excerpt">バッチファイルを使用していて、途中で止めたいところで一時停止したい場合ないでしょうか？ そんな時バッチファイルでは「PAUSE」を使用します。 PAUSEの実用例を現役&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h2 class="wp-block-heading">バッチファイル（bat）の記述で便利なコマンド</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" width="1024" height="683" src="https://sugublog.org/wp-content/uploads/2021/11/programing_1122-7-1024x683.jpg" alt="便利コマンド" class="wp-image-4564" srcset="https://sugublog.org/wp-content/uploads/2021/11/programing_1122-7-1024x683.jpg 1024w, https://sugublog.org/wp-content/uploads/2021/11/programing_1122-7-300x200.jpg 300w, https://sugublog.org/wp-content/uploads/2021/11/programing_1122-7-768x512.jpg 768w, https://sugublog.org/wp-content/uploads/2021/11/programing_1122-7.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>バッチファイルを記述する上で便利なコマンドをご紹介します。</p>



<h3 class="wp-block-heading">バッチファイルで変数を扱う</h3>



<p><span class="swl-inline-color has-swl-deep-01-color">変数を指定するコマンド</span>です。プログラミングで変数を扱えれば便利になります。</p>



<p>バッチファイルでも変数を指定して、展開して使用する事が可能です。</p>



<p class="is-style-big_icon_check">バッチファイル内で同じ文字列などを使用する時に、変数に格納して使用していれば、もし変更する時に変数の値だけ変えるだけで全ての文字列を一斉修正した事になるので便利です。</p>



<p class="is-style-icon_pen">他にも変数には便利なやり方が沢山あります。ここでは割愛しますが興味があれば下の記事へどうぞ</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/08/script_0809-11-300x195.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-hensu/">【bat】バッチファイルで変数や環境変数の使い方！エラー対処法あり</a>
						<span class="p-blogCard__excerpt">バッチファイルで変数や環境変数を設定するやり方を教えます。 その他にも変数に関わる事をご紹介します。 この記事でわかる事 変数を指定する時の注意点など 計算結果&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h3 class="wp-block-heading">バッチファイルで日付を扱う</h3>



<p><strong><span class="swl-inline-color has-swl-deep-01-color">バッチファイルで現在の日付や時間なども使用する事が可能</span></strong>です。</p>



<p>変数の一種ですが、%DATE%や％TIME％と記述する事で、日付や時間などを簡単に取得して使用する事が可能です。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/06/time1-1-min-e1623600613499-300x190.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-date-time/">【bat】バッチで日付や時間を取得する方法！初心者向けで簡単に取得可能</a>
						<span class="p-blogCard__excerpt">バッチで日付や時間を取得できれば出来る事は多くなります。 例えば本日の日付と時間を組み合わせて、ログファイルやディレクトリを作成するなどです。 そうする事によ&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h3 class="wp-block-heading">バッチファイルで好きな場所の処理を実行する</h3>



<p>バッチファイルは内容の上から下へ処理を行っていくと言いましたが、「goto」コマンドを使用すれば好きな場所に移動して処理を続けることが可能です。</p>



<p class="is-style-big_icon_check">このコマンドを使用する事で戻って処理したり、不要な処理を飛ばしてバッチファイルを実行できます。</p>



<p class="is-style-icon_pen">「goto」コマンドの詳しい説明や使用例は以下で紹介しています。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/11/Server_20211109-10-300x153.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-goto/">【bat】バッチファイルでgotoを使い、好きな位置まで移動する方法</a>
						<span class="p-blogCard__excerpt">batファイルで好きな位置まで移動できると色々と便利です。 そんな事出来ないと思っていませんか？ 「goto」コマンドを使用すれば以外と簡単に可能だったので、ここに覚&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h3 class="wp-block-heading">バッチファイルで引数を使用する</h3>



<p><span class="swl-inline-color has-swl-deep-03-color"><span class="swl-marker mark_green">バッチファイルを実行する時に引数を指定して実行する事で、引数を使用する事も可能</span></span>です。</p>



<p>バッチファイル名の後にスペースを入れて引数を指定します。９個まで指定する事が可能です。</p>



<p>引数を用いたバッチファイルのやり方や実行例は以下の記事でまとめています。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/11/Server_20211109-16-300x157.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-argument/">【bat】バッチファイルで引数を取得する方法!スペース含む時なども解説</a>
						<span class="p-blogCard__excerpt">バッチファイルを使用するとWindowsで色んな事が楽に出来ます。更にバッチファイルで引数も取得して扱えたら便利になると思いませんか？ そこで今回はバッチファイルで&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h3 class="wp-block-heading">バッチファイルで色を変更する</h3>



<p>バッチファイルはコマンドプロンプト上で動きますが、<span class="swl-inline-color has-swl-deep-03-color"><span class="swl-marker mark_green">文字や背景の色を変更する事も可能</span></span>です。</p>



<p>メリットとしては作業していてわかりやすいと言ったものです。</p>



<p class="is-style-icon_announce">工程が進むにつれて背景色を変更する！といった現場もかなりありますのでご紹介しておきます。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/08/school_08-3-300x188.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-color-change/">【bat】バッチで文字色と背景色を変えるには？作業ミス防止には必須です</a>
						<span class="p-blogCard__excerpt">batファイルで文字色や背景色を変えたい場合があると思います。 特に背景色はbatによって変更する事があります。わかりやすくする為ですね。 batファイルを渡して業者に&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h2 class="wp-block-heading">実践：初心者におすすめバッチファイル（bat）</h2>



<p>バッチファイルの作り方と記述の基礎や便利な方法はわかったと思います。</p>



<p>では<span class="swl-inline-color has-swl-deep-02-color"><span class="swl-marker mark_blue"><strong>初心者におすすめのバッチファイル</strong></span></span>をご紹介します。</p>



<p>バッチファイルでファイルやフォルダを開く方法です。</p>



<p class="is-style-big_icon_hatena">業務で毎朝使うファイルや開くフォルダなどないでしょうか？そんな時に毎回ひとつひとつ開いていないでしょうか？</p>



<p>そんな時はファイルやフォルダを開くバッチファイルを作成して一気に開きましょう。</p>



<p>コマンドは「start」でその後に開きたいフォルダやファイルのパスを記述するだけです。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/06/programing-1-min-e1624720466314-300x169.png" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/%e3%80%90%e5%88%9d%e5%bf%83%e8%80%85%e5%90%91%e3%81%91%e3%80%91bat%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%a7%e3%83%95%e3%82%a9%e3%83%ab%e3%83%80%e3%82%92%e9%96%8b%e3%81%8f%e6%96%b9%e6%b3%95/">【初心者向け】batファイルでフォルダを開く方法【エラー対処法あり】</a>
						<span class="p-blogCard__excerpt">windowsのパソコンで簡単にファイルやフォルダを開きたい場合どうすればいいのでしょうか？ batファイルを作成すれば簡単に可能です！ これが出来たら色々便利なので、&#8230;</span>					</div>
				</div>
			</div>
		</div>


<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle ads" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-9330904718533231" data-ad-slot="6086594686"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<h2 class="wp-block-heading">実践：複雑なバッチファイルに必須のコマンドご紹介</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" width="1024" height="576" src="https://sugublog.org/wp-content/uploads/2021/11/programing_school1123-3-1024x576.jpg" alt="上級バッチファイル" class="wp-image-4580" srcset="https://sugublog.org/wp-content/uploads/2021/11/programing_school1123-3-1024x576.jpg 1024w, https://sugublog.org/wp-content/uploads/2021/11/programing_school1123-3-300x169.jpg 300w, https://sugublog.org/wp-content/uploads/2021/11/programing_school1123-3-768x432.jpg 768w, https://sugublog.org/wp-content/uploads/2021/11/programing_school1123-3.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p>ファイルやフォルダを開くだけのバッチファイルは簡単です。</p>



<p>またファイルを作成したりコピーしたり削除したりすることも簡単です。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/08/DB0804-3-300x210.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-file-create/">【bat基礎】バッチでファイルを簡単に作成する方法！全３種類ご紹介</a>
						<span class="p-blogCard__excerpt">batファイルでファイルを作成する方法をお伝えします。 ファイルを何個も作成する場合に、batで行えば楽に業務を遂行する事が可能です。 batでファイルを簡単に作成する&#8230;</span>					</div>
				</div>
			</div>
		</div>

<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/11/programing_1122-4-300x164.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-base-copy/">【bat基礎】バッチファイルでcopy（コピー）コマンドの使い方！一括コピーなどご紹介</a>
						<span class="p-blogCard__excerpt">batファイルでcopyコマンドのオプションをご紹介します。 バッチでファイルやディレクトリをコピーできるcopyコマンドですが、オプションを使いこなして効率よくコピー&#8230;</span>					</div>
				</div>
			</div>
		</div>

<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/12/結婚1209-2-300x169.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-file-delete/">【bat】ファイルを削除する方法！エラー対処法あり</a>
						<span class="p-blogCard__excerpt">様々なスクリプトでファイルを削除する方法が違うので、batでファイルを削除する方法を教えて欲しいです。 またファイル削除する前に確認を入れたいです。 問答無用で削&#8230;</span>					</div>
				</div>
			</div>
		</div>

<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/11/programing_shool1121-4-300x180.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-file-move/">【bat基礎】ファイル移動するやり方！ファイル名変更なども行えます！</a>
						<span class="p-blogCard__excerpt">batファイルでファイル移動する場合のやり方を今回行います。 また移動先に同じファイル名があった時の対処法なども、現役エンジニアの筆者が一緒に伝えます。 moveコマ&#8230;</span>					</div>
				</div>
			</div>
		</div>


<p>しかしそれだけでは複雑な処理は不可能です。</p>



<p class="is-style-icon_announce">そこで初心者脱出向けの必須コマンドをご紹介します。</p>



<h3 class="wp-block-heading">バッチファイルで条件分岐する</h3>



<p><span class="swl-inline-color has-swl-deep-03-color"><strong><span class="swl-marker mark_green">「if」コマンドで条件分岐する事がバッチファイルでも可能</span></strong></span>です。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/06/PC223-min-scaled.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-if/">【bat】if文を詳しく説明します。複数条件や数値、文字列の比較まで</a>
						<span class="p-blogCard__excerpt">batファイルで条件分岐したい時には「if」構文を使用します。今回はifを使い方をまとめます。 batファイルに限らずプログラミングの条件分岐で処理を変える事は、業務を&#8230;</span>					</div>
				</div>
			</div>
		</div>


<p>「if」コマンドをマスターしたら出来る事の幅が一気に増えます。</p>



<p>例えばファイルが存在する場合の処理と、存在しない場合の処理を分けて書くことが可能です。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/12/PC教室20211216-9-300x125.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/bat-file-exist-check/">【bat基礎】ファイル存在チェックする方法!existsを使用します！</a>
						<span class="p-blogCard__excerpt">batを使用していてファイル存在チェックしたい場合のやり方をご紹介します。existsを使用します。 もしファイルが存在したら〇〇、存在しなければ作成するといった場合&#8230;</span>					</div>
				</div>
			</div>
		</div>


<h3 class="wp-block-heading">バッチファイルで繰り返し処理をする</h3>



<p><strong><span class="swl-inline-color has-swl-deep-02-color"><span class="swl-marker mark_blue">「for」コマンドで繰り返し処理する事がバッチファイルでも可能</span></span></strong>です。</p>



<p>「if」コマンドと同じでプログラミングで必要なコマンドの内のひとつですね。</p>



<p>繰り返しをマスターすれば、長いコードを簡潔に記述したりすることが可能です。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -internal" data-type="type1" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">あわせて読みたい</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/07/PC007-5-300x200.jpg" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://sugublog.org/windows-bat-for-base/">【bat】バッチで繰り返しを行う！forコマンドの使用方法をご説明</a>
						<span class="p-blogCard__excerpt">バッチファイルを使用しますが、forコマンドが上手くいきません そのような悩みを持っている人も多いのではないでしょうか？ bat（バッチファイル）で繰り返しを行いた&#8230;</span>					</div>
				</div>
			</div>
		</div>

<div class="swell-block-balloon"><div class="c-balloon -bln-left" data-col="blue"><div class="c-balloon__icon -square"><img decoding="async" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="https://sugublog.org/wp-content/uploads/2021/02/mine_white_002-e1624111291945.png" alt="" class="lazyload c-balloon__iconImg" width="80px" height="80px"><noscript><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/02/mine_white_002-e1624111291945.png" alt="" class="c-balloon__iconImg" width="80px" height="80px"></noscript><span class="c-balloon__iconName">管理人</span></div><div class="c-balloon__body -speaking -border-on"><div class="c-balloon__text">
<p>以上がバッチファイルの作り方です。今回紹介したものをマスターするだけで業務効率化がかなりできるようになります。</p>
<span class="c-balloon__shapes"><span class="c-balloon__before"></span><span class="c-balloon__after"></span></span></div></div></div></div>

<div class="swell-block-balloon"><div class="c-balloon -bln-right" data-col="blue"><div class="c-balloon__icon -square"><img decoding="async" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="https://sugublog.org/wp-content/uploads/2021/04/illust10_01.png" alt="" class="lazyload c-balloon__iconImg" width="80px" height="80px"><noscript><img decoding="async" src="https://sugublog.org/wp-content/uploads/2021/04/illust10_01.png" alt="" class="c-balloon__iconImg" width="80px" height="80px"></noscript><span class="c-balloon__iconName">バッチファイル作成アシスタント</span></div><div class="c-balloon__body -speaking -border-on"><div class="c-balloon__text">
<p>バッチファイルを極めてエンジニアの単価を上げていきましょう！</p>
<span class="c-balloon__shapes"><span class="c-balloon__before"></span><span class="c-balloon__after"></span></span></div></div></div></div>]]></content:encoded>
					
					<wfw:commentRss>https://sugublog.org/bat-file-how-to-create/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
