标题: [系统相关] [分享]批处理批量修改软件安装时间指定目录和文件创建时间系统安装时间 [打印本页]
作者: yakeyun 时间: 2022-2-11 20:41 标题: [分享]批处理批量修改软件安装时间指定目录和文件创建时间系统安装时间
将下面代码保存为ANSI格式的bat文件执行即可。
下面代码最开始会用Start命令调用2个脚本,第一个installdate.bat是修改软件安装时间的,用start 直接调用既是以当前用户权限执行一次,然后剩下有几个软件时间无法修改,需要用到“WDC_Nsudo”工具以系统最高权限执行一次,方可修改全部软件的安装时间。也就是普通权限和高级权限各执行一次,这是多次测试后得到的最佳方案。
installtime.bat是修改系统初始安装日期用的,然后后面的代码是获取当前系统时间,然后合成第三方软件“BulkFileChanger.exe”的配置文件,并调用其批量修改软件的创建日期属性。效果图合集:
- @echo off
- cd /d "%~dp0"
-
- Start /min C:\Intel\10\info\installdate.bat
- Start /min C:\Intel\10\info\installtime.bat
- Start /min C:\Intel\10\info\WDC_Nsudo.exe -U:S -P:E -M:S -ShowWindowMode:Hide -Wait C:\Intel\10\info\installdate.bat
-
- for /f "delims=" %%i in ('powershell -c "Get-Date -UFormat '%%d-%%m-%%Y %%H:%%M:%%S'"') do (
- set "SysTS=%%i"
- )
- echo %SysTS%
- >C:\Intel\10\info\BulkFileChanger.cfg echo
- @echo y |copy C:\Intel\10\info\BulkFileChanger.cfg + C:\Intel\10\info\A.DLL C:\Intel\10\info\BulkFileChanger.cfg >nul 2>nul
- echo ChangeTime.Created.DateTime=%SysTS% >>C:\Intel\10\info\BulkFileChanger.cfg
- @echo y |copy C:\Intel\10\info\BulkFileChanger.cfg + C:\Intel\10\info\B.DLL C:\Intel\10\info\BulkFileChanger.cfg >nul 2>nul
- echo ChangeTime.Modified.DateTime=%SysTS% >>C:\Intel\10\info\BulkFileChanger.cfg
- @echo y |copy C:\Intel\10\info\BulkFileChanger.cfg + C:\Intel\10\info\C.DLL C:\Intel\10\info\BulkFileChanger.cfg >nul 2>nul
- echo ChangeTime.Accessed.DateTime=%SysTS% >>C:\Intel\10\info\BulkFileChanger.cfg
- @echo y |copy C:\Intel\10\info\BulkFileChanger.cfg + C:\Intel\10\info\D.DLL C:\Intel\10\info\BulkFileChanger.cfg >nul 2>nul
- echo ChangeTime.StoredInFile.DateTime=%SysTS% >>C:\Intel\10\info\BulkFileChanger.cfg
- @echo y |copy C:\Intel\10\info\BulkFileChanger.cfg + C:\Intel\10\info\E.DLL C:\Intel\10\info\BulkFileChanger.cfg >nul 2>nul
-
- Start /w C:\Intel\10\info\BulkFileChanger.exe /cfg "C:\Intel\10\info\BulkFileChanger.cfg" /ChangeTimeAttr "C:\INTEL" "*" 10 0
- Start /w C:\Intel\10\info\BulkFileChanger.exe /cfg "C:\Intel\10\info\BulkFileChanger.cfg" /ChangeTimeAttr "D:\" "*" 10 0
- Start /w C:\Intel\10\info\BulkFileChanger.exe /cfg "C:\Intel\10\info\BulkFileChanger.cfg" /ChangeTimeAttr "E:\" "*" 10 0
- Start /w C:\Intel\10\info\BulkFileChanger.exe /cfg "C:\Intel\10\info\BulkFileChanger.cfg" /ChangeTimeAttr "F:\" "*" 10 0
-
- ::设置CPU性能百分比
- for /f "tokens=3" %%s in ('powercfg /l ^|find ") *"') do set pws=%%s
- POWERCFG /SETACVALUEINDEX %pws% SUB_PROCESSOR 893dee8e-2bef-41e0-89c6-b55d0929964c 0x00000064
- POWERCFG /SETACVALUEINDEX %pws% SUB_PROCESSOR bc5038f7-23e0-4960-96da-33abaf5935ec 0x00000064
- ::修改时间
- @reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v InstallTime /f >nul
- ::不显示隐藏文件
- @reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t reg_dword /d 00000000 /f
- @reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t reg_dword /d 00000001 /f
- @reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSuperHidden /t reg_dword /d 00000000 /f
-
- exit
复制代码
installdate.bat(这个代码主要是用来修改卸载列表软件安装日期的,由于普通权限下只能修改部分,剩下的需要用管理员权限再执行一次,所以第一个代码会调用2次)代码内容:- @echo off
- set adat=%date:~0,4%%date:~5,2%%date:~8,2%
- echo %adat%
-
- 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"') do (
- reg add "%%a" /v "InstallDate" /d %adat% /t REG_SZ /f
- )
-
- rem 遍历注册表HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall下所有子项并添加或修改installdate的值为当前日期
- for /f "delims=" %%b in ('reg query "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"') do (
- reg add "%%b" /v "InstallDate" /d %adat% /t REG_SZ /f
- )
-
- echo 修改完成!
- exit
复制代码
installtime.bat(这个代码主要是获取当前系统时间戳,并转换为UNIX时间戳然后写入注册表,达到修改系统安装时间的功能)内容:- @echo off
- setlocal
- call :GetUnixTime UNIX_TIME
- echo %UNIX_TIME% 格式标准:1970-01-01 00:00:00
- @reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "InstallDate" /t REG_DWORD /d %UNIX_TIME% /f
- setlocal DisableDelayedExpansion
- exit
-
- :GetUnixTime
- setlocal enableextensions
- for /f %%x in ('wmic path win32_utctime get /format:list ^| findstr "="') do (
- set %%x)
- set /a z=(14-100%Month%%%100)/12, y=10000%Year%%%10000-z
- set /a ut=y*365+y/4-y/100+y/400+(153*(100%Month%%%100+12*z-3)+2)/5+Day-719469
- set /a ut=ut*86400+100%Hour%%%100*3600+100%Minute%%%100*60+100%Second%%%100
- endlocal & set "%1=%ut%" & goto :EOF
复制代码
文件打包下载地址:
https://sanli.lanzouw.com/iMw6Yzxcb3e
所有文件请解压到C:\INTEL\10\INFO\目录下执行,只需执行C-D.BAT即可,调用命令案例:Start /min C:\INTEL\10\INFO\c-d.bat
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |