前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >微软有趣的小命令/小工具

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

原创
作者头像
Windows技术交流
修改2024-05-21 20:12:33
修改2024-05-21 20:12:33
69800
代码可运行
举报
文章被收录于专栏:Windows技术交流Windows技术交流
运行总次数:0
代码可运行

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

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

dureg.exe

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

pathman.exe

代码语言:javascript
代码运行次数:0
复制
添加环境变量的小工具
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 Kits\Tools\pathman.exe" /as c:\test1;c:\test2;c:\test3
执行完后打开一个新的cmd窗口执行echo %path%

empty.exe

代码语言:javascript
代码运行次数:0
复制
释放内存
C:\Windows\system32>empty.exe /?
USAGE: empty.exe {pid | task-name}

now.exe

代码语言:javascript
代码运行次数:0
复制
C:\Windows\system32>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:\Windows\system32>now

Tue May 16 18:30:16 2023

sleep.exe

代码语言:javascript
代码运行次数:0
复制
C:\Windows\system32>sleep.exe
Usage:  sleep.exe      time-to-sleep-in-seconds
        sleep.exe [-m] time-to-sleep-in-milliseconds

subst.exe

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

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

getmac.exe

代码语言:javascript
代码运行次数:0
复制
C:\Windows\system32>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 domain\user /P password /FO list /V
    GETMAC /S system /U domain\user /P password /FO table /NH

showpriv.exe

代码语言:javascript
代码运行次数:0
复制
C:\Windows\system32>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:\Windows\system32>showpriv SeSecurityPrivilege
2 account(s) with the SeSecurityPrivilege user right:
BUILTIN\Administrators
NT AUTHORITY\SYSTEM
All accounts enumerated

C:\Windows\system32>

ntrights.exe

代码语言:javascript
代码运行次数:0
复制
C:\Windows\system32>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
代码运行次数:0
复制
键盘映射小工具,是图形界面工具,不是命令行工具

srvinfo.exe

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

Perms.exe

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

logtime.exe

代码语言:javascript
代码运行次数:0
复制
logtime begin
your real command
logtime end

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

timethis.exe

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

代码语言:javascript
代码运行次数:0
复制
timethis.exe "yourcommand",例如
timethis.exe "systeminfo>c:\sysinfo.txt"

代码语言:javascript
代码运行次数:0
复制
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~1\OpenSSL-Win64\bin\openssl.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~1\OpenSSL-Win64\bin\openssl.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~1\OpenSSL-Win64\bin\openssl.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~1\OpenSSL-Win64\bin\openssl.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~1\OpenSSL-Win64\bin\openssl.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~1\OpenSSL-Win64\bin\openssl.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~1\OpenSSL-Win64\bin\openssl.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~1\OpenSSL-Win64\bin\openssl.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~1\OpenSSL-Win64\bin\openssl.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~1\OpenSSL-Win64\bin\openssl.exe speed sha512 2>&1 1>c:\log.txt"
logtime end

drivers.exe

代码语言:javascript
代码运行次数:0
复制
Windows Kits里的64位drivers.exe单文件:列出驱动
C:\Program Files (x86)\Windows Kits\10\Tools\x64\drivers.exe

copy

代码语言:javascript
代码运行次数:0
复制
拷贝单文件
copy /Y E:\WimBuilder2-Full.v2021-11-11\vendor\WinXShell\X_PF\WinXShell\wallpaper.jpg E:\WimBuilder2-Full.v2022-02-02_updated\vendor\WinXShell\X_PF\WinXShell\wallpaper.jpg
copy /Y E:\WimBuilder2-Full.v2021-11-11\vendor\_PEMaterial_\wallpaper.jpg E:\WimBuilder2-Full.v2022-02-02_updated\vendor\_PEMaterial_\wallpaper.jpg
copy /Y E:\WimBuilder2-Full.v2021-11-11\AppData.tmpl\_CustomFiles_\wallpaper.jpg E:\WimBuilder2-Full.v2022-02-02_updated\AppData.tmpl\_CustomFiles_\wallpaper.jpg
copy /Y E:\WimBuilder2-Full.v2021-11-11\AppData\_CustomFiles_\wallpaper.jpg E:\WimBuilder2-Full.v2022-02-02_updated\AppData\_CustomFiles_\wallpaper.jpg
copy /Y E:\WimBuilder2-Full.v2021-11-11\AppData.tmpl\vendor\_PEMaterial_\wallpaper.jpg E:\WimBuilder2-Full.v2022-02-02_updated\AppData.tmpl\vendor\_PEMaterial_\wallpaper.jpg
copy /Y E:\WimBuilder2-Full.v2021-11-11\AppData\vendor\_PEMaterial_\wallpaper.jpg E:\WimBuilder2-Full.v2022-02-02_updated\AppData\vendor\_PEMaterial_\wallpaper.jpg

xcopy

代码语言:javascript
代码运行次数:0
复制
批量拷贝文件
Xcopy /E /F /H /Y "C:\Users\Administrator\Desktop\sjb\新建文件夹\Windows" "C:\boot\Windows\"

mklink

代码语言:javascript
代码运行次数:0
复制
创建link文件
mklink "c:\python_cloudbaseinit" "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\"  /D

RD

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

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档