forked from zufuliu/notepad4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Batch.bat
912 lines (902 loc) · 14.8 KB
/
Batch.bat
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
:: https://en.wikibooks.org/wiki/Windows_Batch_Scripting
:: https://www.robvanderwoude.com/battech.php
::! keywords ===========================================================
:: built-in command, output from help command
BREAK
CALL
CLS
ECHO
ECHO.
ENDLOCAL EndLocal
EXIT
FOR
IN
DO
GOTO
IF
ELSE
NOT
EXIST
DEFINED
EQU NEQ LSS LEQ GTR GEQ
ERRORLEVEL ErrorLevel
CMDEXTVERSION CmdExtVersion
PAUSE
POPD
REM
SET
SETLOCAL SetLocal
ENABLEEXTENSIONS EnableExtensions
DISABLEEXTENSIONS DisableExtensions
ENABLEDELAYEDEXPANSION EnableDelayedExpansion
DISABLEDELAYEDEXPANSION DisableDelayedExpansion
SHIFT
TITLE
VER
VERIFY
:: other
:: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
CON PRN AUX NUL
COM1 COM2 COM3 COM4 COM5 COM6 COM7 COM8 COM9
LPT1 LPT2 LPT3 LPT4 LPT5 LPT6 LPT7 LPT8 LPT9
::! internal command =======================================================
:: built-in command with arguments
ASSOC
CD
CHDIR
COLOR
COPY
DATE
DEL
DIR
ERASE
FTYPE
MD
MKDIR
MKLINK
MOVE
PATH
PROMPT
PUSHD
RD
REN
RENAME
RMDIR
START
TIME
TYPE
VOL
::! external command =======================================================
:: output from help command
:: *.com
CHCP
FORMAT
MODE
MORE
TREE
:: *.exe
ATTRIB
BCDEDIT
CACLS
CHKDSK
CHKNTFS
CMD
COMP
COMPACT
CONVERT
DISKPART
DOSKEY
DRIVERQUERY
FC
FIND
FINDSTR
FSUTIL
GPRESULT
HELP
ICACLS
LABEL
OPENFILES
PRINT
RECOVER
REPLACE
ROBOCOPY
SC
SCHTASKS
SHUTDOWN
SORT
SUBST
SYSTEMINFO
TASKKILL
TASKLIST
WMIC
XCOPY
:: unknown command
GRAFTABL
:: other commands ===========================================================
:: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands
:: A ===========================================================
active
add
add alias
add volume
append
arp
assign
assoc
at
atmadm
attach-vdisk
attrib
attributes
attributes disk
attributes volume
auditpol
auditpol backup
auditpol clear
auditpol get
auditpol list
auditpol remove
auditpol resourcesacl
auditpol restore
auditpol set
autochk
autoconv
autofmt
automount
:: B ===========================================================
bcdboot
bcdedit
bdehdcfg
bdehdcfg driveinfo
bdehdcfg newdriveletter
bdehdcfg quiet
bdehdcfg restart
bdehdcfg size
bdehdcfg target
begin backup
begin restore
bitsadmin
bitsadmin addfile
bitsadmin addfileset
bitsadmin addfilewithranges
bitsadmin cache
bitsadmin cache and delete
bitsadmin cache and deleteurl
bitsadmin cache and getexpirationtime
bitsadmin cache and getlimit
bitsadmin cache and help
bitsadmin cache and info
bitsadmin cache and list
bitsadmin cache and setexpirationtime
bitsadmin cache and setlimit
bitsadmin cache and clear
bitsadmin cancel
bitsadmin complete
bitsadmin create
bitsadmin examples
bitsadmin getaclflags
bitsadmin getbytestotal
bitsadmin getbytestransferred
bitsadmin getclientcertificate
bitsadmin getcompletiontime
bitsadmin getcreationtime
bitsadmin getcustomheaders
bitsadmin getdescription
bitsadmin getdisplayname
bitsadmin geterror
bitsadmin geterrorcount
bitsadmin getfilestotal
bitsadmin getfilestransferred
bitsadmin gethelpertokenflags
bitsadmin gethelpertokensid
bitsadmin gethttpmethod
bitsadmin getmaxdownloadtime
bitsadmin getminretrydelay
bitsadmin getmodificationtime
bitsadmin getnoprogresstimeout
bitsadmin getnotifycmdline
bitsadmin getnotifyflags
bitsadmin getnotifyinterface
bitsadmin getowner
bitsadmin getpeercachingflags
bitsadmin getpriority
bitsadmin getproxybypasslist
bitsadmin getproxylist
bitsadmin getproxyusage
bitsadmin getreplydata
bitsadmin getreplyfilename
bitsadmin getreplyprogress
bitsadmin getsecurityflags
bitsadmin getstate
bitsadmin gettemporaryname
bitsadmin gettype
bitsadmin getvalidationstate
bitsadmin help
bitsadmin info
bitsadmin list
bitsadmin listfiles
bitsadmin makecustomheaderswriteonly
bitsadmin monitor
bitsadmin nowrap
bitsadmin peercaching
bitsadmin peercaching and getconfigurationflags
bitsadmin peercaching and help
bitsadmin peercaching and setconfigurationflags
bitsadmin peers
bitsadmin peers and clear
bitsadmin peers and discover
bitsadmin peers and help
bitsadmin peers and list
bitsadmin rawreturn
bitsadmin removeclientcertificate
bitsadmin removecredentials
bitsadmin replaceremoteprefix
bitsadmin reset
bitsadmin resume
bitsadmin setaclflag
bitsadmin setclientcertificatebyid
bitsadmin setclientcertificatebyname
bitsadmin setcredentials
bitsadmin setcustomheaders
bitsadmin setdescription
bitsadmin setdisplayname
bitsadmin sethelpertoken
bitsadmin sethelpertokenflags
bitsadmin sethttpmethod
bitsadmin setmaxdownloadtime
bitsadmin setminretrydelay
bitsadmin setnoprogresstimeout
bitsadmin setnotifycmdline
bitsadmin setnotifyflags
bitsadmin setpeercachingflags
bitsadmin setpriority
bitsadmin setproxysettings
bitsadmin setreplyfilename
bitsadmin setsecurityflags
bitsadmin setvalidationstate
bitsadmin suspend
bitsadmin takeownership
bitsadmin transfer
bitsadmin util
bitsadmin util and enableanalyticchannel
bitsadmin util and getieproxy
bitsadmin util and help
bitsadmin util and repairservice
bitsadmin util and setieproxy
bitsadmin util and version
bitsadmin wrap
bootcfg
bootcfg addsw
bootcfg copy
bootcfg dbg1394
bootcfg debug
bootcfg default
bootcfg delete
bootcfg ems
bootcfg query
bootcfg raw
bootcfg rmsw
bootcfg timeout
break
:: C ===========================================================
cacls
call
cd
certreq
certutil
change
change logon
change port
change user
chcp
chdir
chglogon
chgport
chgusr
chkdsk
chkntfs
choice
cipher
clean
cleanmgr
clip
cls
cmd
cmdkey
cmstp
color
comp
compact
compact vdisk
convert
convert basic
convert dynamic
convert gpt
convert mbr
copy
cprofile
create
create partition efi
[create partition extended
create partition logical
create partition msr
create partition primary
create volume mirror
create volume raid
create volume simple
create volume stripe
cscript
:: D ===========================================================
date
dcgpofix
defrag
del
delete
delete disk
delete partition
delete shadows
delete volume
detach vdisk
detail
detail disk
detail partition
detail vdisk
detail volume
dfsdiag
dfsdiag testdcs
dfsdiag testdfsconfig
dfsdiag testdfsintegrity
dfsdiag testreferral
dfsdiag testsites
dfsrmig
diantz
dir
diskcomp
diskcopy
diskpart
diskperf
diskraid
diskshadow
dispdiag
dnscmd
doskey
driverquery
:: E ===========================================================
echo
edit
endlocal
end restore
erase
eventcreate
eventquery
eventtriggers
Evntcmd
exec
exit
expand
expand vdisk
expose
extend
extract
:: F ===========================================================
fc
filesystems
find
findstr
finger
flattemp
fondue
for
forfiles
format
freedisk
fsutil
fsutil 8dot3name
fsutil behavior
fsutil dirty
fsutil file
fsutil fsinfo
fsutil hardlink
fsutil objectid
fsutil quota
fsutil repair
fsutil reparsepoint
fsutil resource
fsutil sparse
fsutil tiering
fsutil transaction
fsutil usn
fsutil volume
fsutil wim
ftp
ftp append
ftp ascii
ftp bell
ftp binary
ftp bye
ftp cd
ftp close
ftp debug
ftp delete
ftp dir
ftp disconnect
ftp get
ftp glob
ftp hash
ftp lcd
ftp literal
ftp ls
ftp mget
ftp mkdir
ftp mls
ftp mput
ftp open
ftp prompt
ftp put
ftp pwd
ftp quit
ftp quote
ftp recv
ftp remotehelp
ftp rename
ftp rmdir
ftp send
ftp status
ftp trace
ftp type
ftp user
ftp verbose
ftp mdelete
ftp mdir
ftype
fveupdate
:: G ===========================================================
getmac
gettype
goto
gpfixup
gpresult
gpt
gpupdate
graftabl
:: H ===========================================================
help
helpctr
hostname
:: I ===========================================================
icacls
if
import (shadowdisk)
import (diskpart)
inactive
inuse
ipconfig
ipxroute
irftp
:: J ===========================================================
jetpack
:: K ===========================================================
klist
ksetup
ksetup addenctypeattr
ksetup addhosttorealmmap
ksetup addkdc
ksetup addkpasswd
ksetup addrealmflags
ksetup changepassword
ksetup delenctypeattr
ksetup delhosttorealmmap
ksetup delkdc
ksetup delkpasswd
ksetup delrealmflags
ksetup domain
ksetup dumpstate
ksetup getenctypeattr
ksetup listrealmflags
ksetup mapuser
ksetup removerealm
ksetup server
ksetup setcomputerpassword
ksetup setenctypeattr
ksetup setrealm
ksetup setrealmflags
ktmutil
ktpass
:: L ===========================================================
label
list
list providers
list shadows
list writers
load metadata
lodctr
logman
logman create
logman create alert
logman create api
logman create cfg
logman create counter
logman create trace
logman delete
logman import and logman export
logman query
logman start and logman stop
logman update
logman update alert
logman update api
logman update cfg
logman update counter
logman update trace
logoff
lpq
lpr
:: M ===========================================================
macfile
makecab
manage bde
manage bde status
manage bde on
manage bde off
manage bde pause
manage bde resume
manage bde lock
manage bde unlock
manage bde autounlock
manage bde protectors
manage bde tpm
manage bde setidentifier
manage bde forcerecovery
manage bde changepassword
manage bde changepin
manage bde changekey
manage bde keypackage
manage bde upgrade
manage bde wipefreespace
mapadmin
md
merge vdisk
mkdir
mklink
mmc
mode
more
mount
mountvol
move
mqbkup
mqsvc
mqtgsvc
msdt
msg
msiexec
msinfo32
mstsc
:: N ===========================================================
nbtstat
netcfg
net print
netsh
netstat
nfsadmin
nfsshare
nfsstat
nlbmgr
nslookup
nslookup exit
nslookup finger
nslookup help
nslookup ls
nslookup lserver
nslookup root
nslookup server
nslookup set
nslookup set all
nslookup set class
nslookup set d2
nslookup set debug
nslookup set domain
nslookup set port
nslookup set querytype
nslookup set recurse
nslookup set retry
nslookup set root
nslookup set search
nslookup set srchlist
nslookup set timeout
nslookup set type
nslookup set vc
nslookup view
ntbackup
ntcmdprompt
ntfrsutl
:: O ===========================================================
offline
offline disk
offline volume
online
online disk
online volume
openfiles
:: P ===========================================================
pagefileconfig
path
pathping
pause
pbadmin
pentnt
perfmon
ping
pnpunattend
pnputil
popd
powershell
powershell ise
print
prncnfg
prndrvr
prnjobs
prnmngr
prnport
prnqctl
prompt
pubprn
pushd
pushprinterconnections
pwlauncher
:: Q ===========================================================
qappsrv
qprocess
query
query process
query session
query termserver
query user
quser
qwinsta
:: R ===========================================================
rcp
rd
rdpsign
recover
recover disk group
refsutil
reg
reg add
reg compare
reg copy
reg delete
reg export
reg import
reg load
reg query
reg restore
reg save
reg unload
regini
regsvr32
relog
rem
remove
ren
rename
repair
repair bde
replace
rescan
reset
reset session
retain
revert
rexec
risetup
rmdir
robocopy
route ws2008
rpcinfo
rpcping
rsh
rundll32
rundll32 printui
rwinsta
:: S ===========================================================
san
sc config
sc create
sc delete
sc query
schtasks
scwcmd
scwcmd analyze
scwcmd configure
scwcmd register
scwcmd rollback
scwcmd transform
scwcmd view
secedit
secedit analyze
secedit configure
secedit export
secedit generaterollback
secedit import
secedit validate
select
select disk
select partition
select vdisk
select volume
serverceipoptin
servermanagercmd
serverweroptin
set environmental variables
set shadow copy
set context
set id
setlocal
set metadata
set option
set verbose
setx
sfc
shadow
shift
showmount
shrink
shutdown
simulate restore
sort
start
subcommand set device
subcommand set drivergroup
subcommand set drivergroupfilter
subcommand set driverpackage
subcommand set image
subcommand set imagegroup
subcommand set server
subcommand set transportserver
subcommand set multicasttransmission
subcommand start namespace
subcommand start server
subcommand start transportserver
subcommand stop server
subcommand stop transportserver
subst
sxstrace
sysocmgr
systeminfo
:: T ===========================================================
takeown
tapicfg
taskkill
tasklist
tcmsetup
telnet
telnet close
telnet display
telnet open
telnet quit
telnet send
telnet set
telnet status
telnet unset
tftp
time
timeout
title
tlntadmn
tpmtool
tpmvscmgr
tracerpt
tracert
tree
tscon
tsdiscon
tsecimp
tskill
tsprof
type
typeperf
tzutil
:: U ===========================================================
unexpose
uniqueid
unlodctr
:: V ===========================================================
ver
verifier
verify
vol
vssadmin
vssadmin delete shadows
vssadmin list shadows
vssadmin list writers
vssadmin resize shadowstorage
:: W ===========================================================
waitfor
wbadmin
wbadmin delete catalog
wbadmin delete systemstatebackup
wbadmin disable backup
wbadmin enable backup
wbadmin get disks
wbadmin get items
wbadmin get status
wbadmin get versions
wbadmin restore catalog
wbadmin start backup
wbadmin start recovery
wbadmin start sysrecovery
wbadmin start systemstatebackup
wbadmin start systemstaterecovery
wbadmin stop job
wdsutil
wecutil
wevtutil
where
whoami
winnt
winnt32
winpop
winrs
winsat mem
winsat mfmedia
wmic
writer
wscript
:: X ===========================================================
xcopy
::! environment variables ===================================================
:: IF /?
CMDCMDLINE CmdCmdLine
:: SET /?
RANDOM Random random
HIGHESTNUMANODENUMBER HighestNumaNodeNumber
:: Dynamic Environment Variables, https://www.robvanderwoude.com/ntset.php
ExitCode
ExitCodeAscii
__APPDIR__ __AppDir__
__CD__
:: some system environment variables: SET
ALLUSERSPROFILE AllUsersProfile
APPDATA AppData
CommonProgramFiles
CommonProgramFiles(x86)
CommonProgramW6432
COMPUTERNAME ComputerName
ComSpec
DriverData
HOMEDRIVE HomeDrive
HOMEPATH HomePath
LOCALAPPDATA LocalAppData
LOGONSERVER LogonServer
NUMBER_OF_PROCESSORS Number_Of_Processors
OS
Path
PATHEXT PathExt
PROCESSOR_ARCHITECTURE Processor_Architecture
PROCESSOR_IDENTIFIER Processor_Identifier
PROCESSOR_LEVEL Processor_Level
PROCESSOR_REVISION Processor_Revision
ProgramData
ProgramFiles
ProgramFiles(x86)
ProgramW6432
PSModulePath
PUBLIC Public
SESSIONNAME SessionName
SystemDrive
SystemRoot
TEMP
TMP
USERDOMAIN UserDomain
USERDOMAIN_ROAMINGPROFILE UserDomain_RoamingProfile
USERNAME UserName
USERPROFILE UserProfile
windir WINDIR WinDir
::! options ===========================================================
:: FOR /?
eol skip delims tokens usebackq
:: START /?
MIN MAX SEPARATE SHARED LOW NORMAL HIGH REALTIME ABOVENORMAL BELOWNORMAL NODE AFFINITY WAIT
min max separate shared low normal high realtime abovenormal belownormal node affinity wait
:: GOTO /?
EOF eof