![[ 命令提示字元 ]如何用 fsutil file createnew 指令建立指定大小的檔案?](https://key.chtouch.com/ReadImage.ashx?OBlogPhotoItems=17806)
如果需要透過檔案來測試應用程式或網路服務,那麼就會有需要指定檔案的大小,該如何產生一個是可以用於測試的檔案且又符合要測試的大小呢?這時候,我們可以透過[ 命令提示字元 ]使用 fsutil file createnew 指令來操作,只要指定好儲存路徑、檔案名稱與檔案大小,就可以產生一個相符合的檔案,免去測試時期的困擾。
1.開啟[ 命令提示字元 ]後,可先輸入 fsutil file createnew /? 來看看其用法,注意其後的數字是以 bytes 來計算。
![[ 命令提示字元 ]如何用 fsutil file createnew 指令建立指定大小的檔案?](/ReadImage.ashx?OBlogPhotoItems=17806)
2.接下來就可以實際產生一個 100MB的檔案來試試。
![[ 命令提示字元 ]如何用 fsutil file createnew 指令建立指定大小的檔案?](/ReadImage.ashx?OBlogPhotoItems=17808)
3.透過檔案的內容可以清楚看到檔案的大小,可以產生 100Mb大小的檔案,也就可以產生 1GB的檔案(1073741824)。
![[ 命令提示字元 ]如何用 fsutil file createnew 指令建立指定大小的檔案?](/ReadImage.ashx?OBlogPhotoItems=17807)