Skip to content

Instantly share code, notes, and snippets.

@nukino
Created March 9, 2012 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukino/2009159 to your computer and use it in GitHub Desktop.
Save nukino/2009159 to your computer and use it in GitHub Desktop.
[20120310-0755]make_CentOS6_file.bat/CentOS6ファイル化バッチ
@echo off
set exe_7zip="C:\Program Files\7-Zip\7z.exe"
::末尾に"\"を付けては駄目
set dir_centos=C:\Work\Original\CentOS6
if exist %dir_centos%.tar del %dir_centos%.tar
%exe_7zip% a %dir_centos%.tar %dir_centos%
if not exist %dir_centos%.tar exit /B
::先頭16バイトに適当なデータを付ける
cd /d %~dp0
fsutil file createnew tempfile 16
copy /B /Y tempfile+%dir_centos%.tar %dir_centos%_
del tempfile %dir_centos%.tar
::サイズを2倍に
if not exist %dir_centos%_ exit /B
copy /B /Y %dir_centos%_+%dir_centos%_ %dir_centos%__
del %dir_centos%_
ren %dir_centos%__ %dir_centos%_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment