微软有趣的小命令/小工具

2024-05-21 20:12:33 浏览数 (2)

在线下载小工具:https://support.modelamerican.com/downloads/Utilities/Windows/ResKit/

或者https://technlg.net/downloads/rktools.exe下载这个rktools.exe安装,在C:Program Files (x86)Windows Resource KitsTools下面会有很多小工具,由于已经20年了,大部分已经不能用了,但有些小工具仍然通用所有Windows系统,我列举一些如下。

dureg.exe

代码语言:javascript复制
注册表大小估算器
http://download.microsoft.com/download/win2000platform/WebPacks/1.00.0.1/NT5/EN-US/Dureg.exe

pathman.exe

代码语言:javascript复制
添加环境变量的小工具
mkdir c:test
pathman.exe /as c:test
执行完后打开一个新的cmd窗口执行echo %path%
mkdir c:test1
mkdir c:test2
mkdir c:test3
"C:Program Files (x86)Windows Resource KitsToolspathman.exe" /as c:test1;c:test2;c:test3
执行完后打开一个新的cmd窗口执行echo %path%

empty.exe

代码语言:javascript复制
释放内存
C:Windowssystem32>empty.exe /?
USAGE: empty.exe {pid | task-name}

now.exe

代码语言:javascript复制
C:Windowssystem32>now.exe /?

--------------------------------------------------
NOW  :  Display Message with Current Date and Time
--------------------------------------------------

Usage : NOW [message to be printed with time-stamp]

  NOW displays the current time, followed by its command-line arguments.
  NOW is similar to the standard ECHO command, but with a time-stamp.
.
C:Windowssystem32>now

Tue May 16 18:30:16 2023

sleep.exe

代码语言:javascript复制
C:Windowssystem32>sleep.exe
Usage:  sleep.exe      time-to-sleep-in-seconds
        sleep.exe [-m] time-to-sleep-in-milliseconds

subst.exe

代码语言:javascript复制
长路径变盘符根目录
SUBST [drive1: [drive2:]path]
SUBST drive1: /D

  drive1:        指定要分配路径的虚拟驱动器。
  [drive2:]path  指定物理驱动器和要分配给虚拟驱动器的路径。
  /D             删除被替换的

getmac.exe

代码语言:javascript复制
C:Windowssystem32>getmac.exe /?

GETMAC [/S system [/U username [/P [password]]]] [/FO format] [/NH] [/V]

描述:
    此工具使管理员能够显示系统上网络适配器的 MAC 地址。

参数列表:
    /S     system            指定要连接的远程系统。

    /U     [domain]user     指定用户上下文,命令在此上下文执行。

    /P     [password]        指定给定用户上下文密码。如果省略则
                             提示输入。

    /FO    format            指定输出显示的格式。
                             有效值: "TABLE"、"LIST"、"CSV"。

    /NH                      指定在输出中不显示“列标题”。
                             只对 TABLE 和 CSV 格式有效。


    /V                       指定显示详细输出。

    /?                       显示此帮助消息。

示例:
    GETMAC /?
    GETMAC /FO csv
    GETMAC /S system /NH /V
    GETMAC /S system /U user
    GETMAC /S system /U domainuser /P password /FO list /V
    GETMAC /S system /U domainuser /P password /FO table /NH

showpriv.exe

代码语言:javascript复制
C:Windowssystem32>showpriv.exe /?
ShowPriv.exe
Displays the trustees assigned to a privilege (user right).
(c) 1999 Microsoft Corporation.

Usage: showpriv <privilegename>
where <privilegename> is a valid Windows NT privilege string.

Example: showpriv SeSecurityPrivilege

Privileges:
SeCreateTokenPrivilege                  SeAssignPrimaryTokenPrivilege
SeLockMemoryPrivilege                   SeIncreaseQuotaPrivilege
SeMachineAccountPrivilege               SeTcbPrivilege
SeSecurityPrivilege                     SeTakeOwnershipPrivilege
SeLoadDriverPrivilege                   SeSystemProfilePrivilege
SeSystemtimePrivilege                   SeProfileSingleProcessPrivilege
SeIncreaseBasePriorityPrivilege         SeCreatePagefilePrivilege
SeCreatePermanentPrivilege              SeBackupPrivilege
SeRestorePrivilege                      SeShutdownPrivilege
SeDebugPrivilege                        SeAuditPrivilege
SeSystemEnvironmentPrivilege            SeChangeNotifyPrivilege
SeRemoteShutdownPrivilege               SeUndockPrivilege
SeSyncAgentPrivilege                    SeEnableDelegationPrivilege

C:Windowssystem32>showpriv SeSecurityPrivilege
2 account(s) with the SeSecurityPrivilege user right:
BUILTINAdministrators
NT AUTHORITYSYSTEM
All accounts enumerated

C:Windowssystem32>

ntrights.exe

代码语言:javascript复制
C:Windowssystem32>ntrights.exe /?
NTRights.Exe - Beta Version by Georg Zanzen
Grants/Revokes NT-Rights to a user/group
usage: -u xxx  User/Group
       -m \xxx  machine to perform the operation on (default local machine)
       -e xxxxx Add xxxxx to the event log
       -r xxx  revokes the xxx right
        r xxx  grants the xxx right
valid NTRights are:
  SeCreateTokenPrivilege
  SeAssignPrimaryTokenPrivilege
  SeLockMemoryPrivilege
  SeIncreaseQuotaPrivilege
  SeUnsolicitedInputPrivilege
  SeMachineAccountPrivilege
  SeTcbPrivilege
  SeSecurityPrivilege
  SeTakeOwnershipPrivilege
  SeLoadDriverPrivilege
  SeSystemProfilePrivilege
  SeSystemtimePrivilege
  SeProfileSingleProcessPrivilege
  SeIncreaseBasePriorityPrivilege
  SeCreatePagefilePrivilege
  SeCreatePermanentPrivilege
  SeBackupPrivilege
  SeRestorePrivilege
  SeShutdownPrivilege
  SeAuditPrivilege
  SeSystemEnvironmentPrivilege
  SeChangeNotifyPrivilege
  SeRemoteShutdownPrivilege

remapkey.exe

代码语言:javascript复制
键盘映射小工具,是图形界面工具,不是命令行工具

srvinfo.exe

代码语言:javascript复制
list服务信息的小工具,并且尾部会显示System Up Time

Perms.exe

代码语言:javascript复制
Perms 显示指定文件或文件夹的用户访问权限

logtime.exe

代码语言:javascript复制
logtime begin
your real command
logtime end

执行命令前后分别用logtime begin和logtime end打时间戳,在命令执行的当前目录会生成一个logtime.log的文本文件记录时间戳

timethis.exe

这是一个统计执行时间的妙工具

代码语言:javascript复制
timethis.exe "yourcommand",例如
timethis.exe "systeminfo>c:sysinfo.txt"

代码语言:javascript复制
timethis.exe的局限:指定vCPU运行的话,最多只能支持到第64个vCPU
第1颗CPU是/node 0

第2颗CPU的第4颗vCPU:
timethis.exe "start /wait /b /node 1 /affinity 0x8 cmd /c c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"
第2颗CPU的第8颗vCPU:
timethis.exe "start /wait /b /node 1 /affinity 0x80 cmd /c c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"
第2颗CPU的第12颗vCPU:
timethis.exe "start /wait /b /node 1 /affinity 0x800 cmd /c c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"
第2颗CPU的第16颗vCPU:
timethis.exe "start /wait /b /node 1 /affinity 0x8000 cmd /c c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"
第2颗CPU的第20颗vCPU:
timethis.exe "start /wait /b /node 1 /affinity 0x80000 cmd /c c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"
第2颗CPU的第24颗vCPU:
timethis.exe "start /wait /b /node 1 /affinity 0x800000 cmd /c c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"
第2颗CPU的第28颗vCPU:
timethis.exe "start /wait /b /node 1 /affinity 0x8000000 cmd /c c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"
第2颗CPU的第32颗vCPU:
timethis.exe "start /wait /b /node 1 /affinity 0x80000000 cmd /c c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"

timethis.exe的局限,用logtime.exe规避
第2颗CPU的第36颗vCPU(超出64,报错):
logtime begin
start /wait /b /node 1 /affinity 0x800000000 cmd /c "c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"
logtime end

第2颗CPU的第40颗vCPU(超出64,报错):
logtime begin
start /wait /b /node 1 /affinity 0x8000000000 cmd /c "c:progra~1OpenSSL-Win64binopenssl.exe speed sha512 2>&1 1>c:log.txt"
logtime end

drivers.exe

代码语言:javascript复制
Windows Kits里的64位drivers.exe单文件:列出驱动
C:Program Files (x86)Windows Kits10Toolsx64drivers.exe

copy

代码语言:javascript复制
拷贝单文件
copy /Y E:WimBuilder2-Full.v2021-11-11vendorWinXShellX_PFWinXShellwallpaper.jpg E:WimBuilder2-Full.v2022-02-02_updatedvendorWinXShellX_PFWinXShellwallpaper.jpg
copy /Y E:WimBuilder2-Full.v2021-11-11vendor_PEMaterial_wallpaper.jpg E:WimBuilder2-Full.v2022-02-02_updatedvendor_PEMaterial_wallpaper.jpg
copy /Y E:WimBuilder2-Full.v2021-11-11AppData.tmpl_CustomFiles_wallpaper.jpg E:WimBuilder2-Full.v2022-02-02_updatedAppData.tmpl_CustomFiles_wallpaper.jpg
copy /Y E:WimBuilder2-Full.v2021-11-11AppData_CustomFiles_wallpaper.jpg E:WimBuilder2-Full.v2022-02-02_updatedAppData_CustomFiles_wallpaper.jpg
copy /Y E:WimBuilder2-Full.v2021-11-11AppData.tmplvendor_PEMaterial_wallpaper.jpg E:WimBuilder2-Full.v2022-02-02_updatedAppData.tmplvendor_PEMaterial_wallpaper.jpg
copy /Y E:WimBuilder2-Full.v2021-11-11AppDatavendor_PEMaterial_wallpaper.jpg E:WimBuilder2-Full.v2022-02-02_updatedAppDatavendor_PEMaterial_wallpaper.jpg

xcopy

代码语言:javascript复制
批量拷贝文件
Xcopy /E /F /H /Y "C:UsersAdministratorDesktopsjb新建文件夹Windows" "C:bootWindows"

mklink

代码语言:javascript复制
创建link文件
mklink "c:python_cloudbaseinit" "C:Program FilesCloudbase SolutionsCloudbase-InitPython"  /D

RD

代码语言:javascript复制
删除文件夹
TAKEOWN /F %SystemDrive%Windows.old /A /R /D Y
ICACLS %SystemDrive%Windows.old /T /grant :r Administrators:F
RD /S /Q %SystemDrive%Windows.old

0 人点赞