<?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>fsutil.PowerShell &#8211; 楽しいブログ</title>
	<atom:link href="https://cs.machijun.net/tag/fsutil-powershell/feed/" rel="self" type="application/rss+xml" />
	<link>https://cs.machijun.net/</link>
	<description>コンピュータ関連の記事を書いていこうかな</description>
	<lastBuildDate>Mon, 07 Jan 2019 13:45:01 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.2.15</generator>
	<item>
		<title>Windowsで大きいファイルを簡単につくろう</title>
		<link>https://cs.machijun.net/make-bigsize-file.html</link>
				<pubDate>Mon, 07 Jan 2019 13:45:01 +0000</pubDate>
		<dc:creator><![CDATA[machijun]]></dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[fsutil.PowerShell]]></category>

		<guid isPermaLink="false">https://cs.machijun.net/?p=390</guid>
				<description><![CDATA[開発やテストをしていると大きいサイズのファイルが必要にな...]]></description>
								<content:encoded><![CDATA[<p>開発やテストをしていると<span class="marker_yellow_narrow">大きいサイズのファイルが必要になることがありますよね</span>.</p>
<p>例えばネットワーク転送の時間を図ったり, ファイルサイズが正しく表示できるか確認したり.</p>
<p>そういったときに, 今日紹介する方法で大きいサイズのファイルを簡単に作れるんです.</p>
<p><span id="more-390"></span></p>
<h3>PowerShellでファイルサイズを計算する</h3>
<p>まず作りたいファイルサイズをByte換算してください.例えば1GBのファイルを作りたければ「1073741824」です.これは1024*1024*1024の値です.</p>
<p>といっても、ちょっとめんどくさいですよね.PowerShellならすぐに計算できますので活用しましょう.</p>
<p>PowerShellを開き, [1GB]と入力します.</p>
<pre class="brush: powershell; title: ; notranslate">
PS D:\&gt; 1GB
1073741824
</pre>
<p>こんな感じで[KB][MB][GB][TB][PB]を簡単に計算することができます.もちろん小数点も使えます.例えば 1.5GBは,</p>
<pre class="brush: powershell; title: ; notranslate">
PS D:&gt; 1.5GB
1610612736
</pre>
<p>と正しく計算できます.</p>
<h3>fsutilでファイルを作成する</h3>
<p>いよいよファイル作成です.fsutilというツールでファイルを作成します.</p>
<p>コマンド構文は<br />
fsutil file createnew &lt;filename&gt; &lt;filesize&gt;<br />
です.filenameはパスを含めてかまいません.</p>
<pre class="brush: powershell; title: ; notranslate">
PS D:\&gt; fsutil file createnew D:\tmp\testfile 1073741824
ファイル D:\tmp\testfile が作成されました
PS D:\&gt; dir d:\tmp


    ディレクトリ: D:\tmp


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       2019/01/07     22:35     1073741824 testfile
</pre>
<p>と確かに指定されたサイズでファイルが出来上がっています.<br />
ちなみに, ファイルの中身は全て&#8221;0&#8243;です.<br />
ですので, <span class="marker_pink_narrow">ファイルの中身が重要な意味を持つデータに対するテスト（圧縮処理など）には向きません</span>ので留意ください.</p>
]]></content:encoded>
										</item>
	</channel>
</rss>
