부팅 시 스크립트 예제

최종 업데이트일: 2022년 6월 6일

다음 예시들을 통해 일반적인 부팅 시 디스크 조각 모음 작업을 수행하는 방법을 알아보세요.

기본 사용자 지정 부팅 시간 스크립트

UltraDefrag 기본적으로 다음 스크립트를 사용자 지정 부팅 스크립트로 사용합니다

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@echo off
::
:: UltraDefrag - a powerful disk defragmenter for Windows.
::
:: ud-boot-time-custom.cmd - custom script for boot time defragmentation.
::
:: Visit https://en.wikibooks.org/wiki/Windows_Batch_Scripting
:: for general information about the script syntax.
::
:: Refer to the Boot time interface section of UltraDefrag documentation
:: at https://ultradefrag.net/support/boot-time-interface/ for detailed
:: information about the supported commands and environment variables
:: controlling their behaviour.
::
:: Please note that you have to save this file in Unicode
:: (UTF-16 / UCS-2 LE BOM) encoding.
::
:: For syntax highlighting the Notepad++ editor can be used.
:: The latest version of it can be downloaded for free from
:: http://www.notepad-plus-plus.org/
::

:: Below is a sample script. It defragments system files, including

:: registry, paging and hibernation files. Feel free to adjust it
:: to make it more suitable for your needs, replace it entirely
:: or keep as is.

:: turn the boot time defragmentation off for subsequent boots

boot-off

set UD_CLEAN_TEMP_FILES=1
set UD_TEMP_FILES_EXP_TIME=24h
set UD_DEFRAGMENTATION_DEPTH=80
set UD_IN_FILTER=*windows*;*winnt*;*ntuser*;*pagefile.sys;*hiberfil.sys
set UD_EX_FILTER=*temp*;*tmp*;*dllcache*;*ServicePackFiles*;*.log;*Windows.old*
set UD_EX_FILTER=%UD_EX_FILTER%;*\Windows\servicing\*

:: exclude big fragments which rarely benefit from defragmentation

set UD_FRAGMENT_SIZE_THRESHOLD=20MB

:: on solid state drives exclude slightly fragmented content as well

set UD_SSD_FRAGMENTS_THRESHOLD=20

:: uncomment the following line to increase amount of debugging output

:: set UD_DBGPRINT_LEVEL=DETAILED

:: uncomment the following line to save debugging output to a log file

:: set UD_LOG_FILE_PATH=%UD_INSTALL_DIR%\logs\ud-boot-time.log

udefrag %SystemDrive%

exit

디스크 최적화

사용자 지정 부팅 스크립트를 사용하여 디스크를 최적화하려는 경우 UD_SSD_DEFRAGMENT_AND_TRIM_ONLY , 특히 시스템에 솔리드 스테이트 드라이브(SSD)가 설치되어 있다면 디스크 최적화 전에 환경 변수를 설정하는 것을 고려하십시오. 이 옵션을 사용하면 최적화 효율을 저하시키지 않으면서 SSD 최적화 시간을 크게 단축할 수 있습니다. 또한 SSD의 수명도 연장할 수 있습니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
@echo off
::
:: This script performs the full optimization
:: of all the available non-removable disks
:: except solid state drives (SSD) for which
:: it performs defragmentation and trimming only.
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

:: skip slightly fragmented files on SSD

set UD_SSD_FRAGMENTS_THRESHOLD=20

:: during SSD optimization defragment and trim the disk only

set UD_SSD_DEFRAGMENT_AND_TRIM_ONLY=1

:: place Windows boot, hibernation and paging files

:: to the very beginning of the system disk
set HPF=%SystemRoot%\system32\ntoskrnl.exe
set HPF=%HPF%;%SystemRoot%\system32\bootvid.dll
set HPF=%HPF%;%SystemRoot%\system32\hal.dll
set HPF=%HPF%;%SystemRoot%\system32\*.nls
set HPF=%HPF%;%SystemRoot%\system32\config\SYSTEM
set HPF=%HPF%;%SystemRoot%\system32\drivers\*
set HPF=%HPF%;%SystemDrive%\hiberfil.sys
set HPF=%HPF%;%SystemDrive%\pagefile.sys
set UD_HIGH_PRIORITY_FILES=%HPF%

udefrag -o --all-fixed

:: pass control back to the Windows boot process

exit

조각 모음에서 파일 제외

임시 파일, 압축 파일 및 멀티미디어 파일은 일반적으로 시스템 성능에 영향을 미치지 않으므로 디스크 처리 시간을 단축하기 위해 조각 모음에서 제외해야 합니다.

자동 디스크 조각 모음 스크립트 에서와 마찬가지로 환경 변수를 사용하면 이 모든 항목을 쉽게 제외할 수 있습니다 .UD_EX_FILTER

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@echo off
::
:: This script excludes temporary files, archives,
:: multimedia files and big fragments from defragmentation
:: and then defragments all the available non-removable disks.
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

:: exclude temporary files

set UD_EX_FILTER=*system volume information*;*temp*;*tmp*;*recycle*
set UD_EX_FILTER=%UD_EX_FILTER%;*dllcache*;*ServicePackFiles*;*.log
set UD_EX_FILTER=%UD_EX_FILTER%;*Windows.old*

:: exclude archives

set ARCHIVE_PATTERNS=*.7z;*.7z.*;*.arj;*.bkf;*.bz2;*.bzip2;*.cab;*.cpio;*.deb
set ARCHIVE_PATTERNS=%ARCHIVE_PATTERNS%;*.dmg;*.gz;*.gzip;*.lha;*.lzh;*.lzma
set ARCHIVE_PATTERNS=%ARCHIVE_PATTERNS%;*.rar;*.rpm;*.swm;*.tar;*.taz;*.tbz
set ARCHIVE_PATTERNS=%ARCHIVE_PATTERNS%;*.tbz2;*.tgz;*.tpz;*.txz;*.xar;*.xz
set ARCHIVE_PATTERNS=%ARCHIVE_PATTERNS%;*.z;*.zip
set UD_EX_FILTER=%UD_EX_FILTER%;%ARCHIVE_PATTERNS%

:: exclude multimedia files

set AUDIO_PATTERNS=*.aif;*.cda;*.flac;*.iff;*.kpl;*.m3u;*.m4a;*.mid
set AUDIO_PATTERNS=%AUDIO_PATTERNS%;*.mp3;*.mpa;*.ra;*.wav;*.wma
set VIDEO_PATTERNS=*.3g2;*.3gp;*.asf;*.asx;*.avi;*.flv;*.mov;*.mp4
set VIDEO_PATTERNS=%VIDEO_PATTERNS%;*.mpg;*.rm;*.srt;*.swf;*.vob;*.wmv
set UD_EX_FILTER=%UD_EX_FILTER%;%AUDIO_PATTERNS%;%VIDEO_PATTERNS%

:: exclude big fragments

set UD_FRAGMENT_SIZE_THRESHOLD=20MB

:: defragment all the available non-removable disks

udefrag --all-fixed

:: pass control back to the Windows boot process

exit

디스크 조각 모음에서 제외

디스크 조각 모음에서 특정 디스크를 제외하려면 UD_EX_FILTER 환경 변수를 사용하면 간단하게 할 수 있습니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@echo off
::
:: This script defragments all the available
:: non-removable disks except the disk H:
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

set UD_EX_FILTER=%UD_EX_FILTER%;H:\*

udefrag --all-fixed

:: pass control back to the Windows boot process

exit

또한 특정 단편화 수준을 가진 디스크를 쉽게 제외할 수도 있습니다

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@echo off
::
:: This script performs the full optimization
:: of all the available non-removable disks
:: having fragmentation level above 20%.
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

set UD_FRAGMENTATION_THRESHOLD=20

:: place Windows boot, hibernation and paging files

:: to the very beginning of the system disk
set HPF=%SystemRoot%\system32\ntoskrnl.exe
set HPF=%HPF%;%SystemRoot%\system32\bootvid.dll
set HPF=%HPF%;%SystemRoot%\system32\hal.dll
set HPF=%HPF%;%SystemRoot%\system32\*.nls
set HPF=%HPF%;%SystemRoot%\system32\config\SYSTEM
set HPF=%HPF%;%SystemRoot%\system32\drivers\*
set HPF=%HPF%;%SystemDrive%\hiberfil.sys
set HPF=%HPF%;%SystemDrive%\pagefile.sys
set UD_HIGH_PRIORITY_FILES=%HPF%

udefrag -o --all-fixed

:: pass control back to the Windows boot process

exit

작업 완료 후 자동 종료

작업 완료 후 컴퓨터를 자동으로 종료하는 기능을 간편하게 사용할 수 있습니다. 이 기능은 디스크 최적화와 같이 시간이 오래 걸리는 작업을 수행할 때 특히 유용합니다

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@echo off
::
:: This script optimizes the system disk
:: and then shuts the computer down.
::
:: Please note, you have to save this script
:: in Unicode (UTF-16 / UCS-2 LE BOM) encoding.
::

:: turn the boot time defragmentation off for subsequent boots

boot-off

:: place Windows boot, hibernation and paging files

:: to the very beginning of the system disk
set HPF=%SystemRoot%\system32\ntoskrnl.exe
set HPF=%HPF%;%SystemRoot%\system32\bootvid.dll
set HPF=%HPF%;%SystemRoot%\system32\hal.dll
set HPF=%HPF%;%SystemRoot%\system32\*.nls
set HPF=%HPF%;%SystemRoot%\system32\config\SYSTEM
set HPF=%HPF%;%SystemRoot%\system32\drivers\*
set HPF=%HPF%;%SystemDrive%\hiberfil.sys
set HPF=%HPF%;%SystemDrive%\pagefile.sys
set UD_HIGH_PRIORITY_FILES=%HPF%

:: optimize the system disk

udefrag -o %SystemDrive%

:: shut the computer down when the disk optimization finishes

shutdown
이 페이지를 공유하세요:
맨 위로 스크롤하세요 영어