本帖最后由 yakeyun 于 2022-1-11 00:38 编辑
回复 7# yakeyun
已经测试成功,"/d"前面要多一个空格,也就是2个空格,不然有些注册表项自动创建不了,同时管理员权限必不可少。- @echo off&setlocal enabledelayedexpansion
- %1 %2
- ver|find "5.">nul&&goto :Admin
- mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :Admin","","runas",1)(window.close)&goto :eof
- :Admin
- ::自定义完系统时间,然后再修改,即可将软件安装时间修改成指定日期和时间。
- date 2022-01-10
- time 10:10
- set a=%date:~0,4%%date:~5,2%%date:~8,2%
- echo %a%
-
- rem 遍历注册表HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall下所有子项并添加或修改installdate的值为当前日期
- for /f "delims=" %%A in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /reg:32') do (
- reg add "%%A" /v "InstallDate" /t REG_SZ /d "%a%" /f
- )
- for /f "delims=" %%A in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /reg:64') do (
- reg add "%%A" /v "InstallDate" /t REG_SZ /d "%a%" /f
- )
- for /f "delims=" %%A in ('reg query "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /reg:32') do (
- reg add "%%A" /v "InstallDate" /t REG_SZ /d "%a%" /f
- )
- for /f "delims=" %%A in ('reg query "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /reg:64') do (
- reg add "%%A" /v "InstallDate" /t REG_SZ /d "%a%" /f
- )
- pause
- exit
复制代码
|