Windows中通过bat脚本修改系统默认日期与时间

Windows中通过bat脚本修改系统默认日期与时间

文章目录

修改操作系统的默认日期与时间脚本

在某些应用场景下需要程序调用bat脚本来修改操作系统的默认日期与时间,来达到测相关应用或服务的目的。

  1. resetDateTime.bat内容如下
shell 复制代码
@echo off
rem 设置要重置的日期和时间
set new_date=2022-01-01
set new_time=12:00:00

rem 将新日期设置为系统日期
date %new_date%

rem 将新时间设置为系统时间
time %new_time%

echo System date and time have been reset to %new_date% %new_time%

pause
  1. 如果需要定时重置,则可通过Windows任务计划程序来定期运行该脚本,以达到定时重置系统默认日期和时间的目的。
  2. 关于Window系统执行定时任务的配置可点击下方链接查看
    Windows中通过任务计划程序定时执行bat脚本-CSDN博客
相关推荐
路由侠内网穿透3 天前
本地部署 GPS 跟踪系统 Traccar 并实现外部访问
运维·服务器·网络·windows·tcp/ip
研华嵌入式3 天前
如何在高通跃龙QCS6490 Arm架构上使用Windows 11 IoT企业版?
arm开发·windows·嵌入式硬件
带娃的IT创业者3 天前
Windows 平台上基于 MCP 构建“文心一言+彩云天气”服务实战
人工智能·windows·文心一言·mcp
csdn_aspnet3 天前
Windows Node.js 安装及环境配置详细教程
windows·node.js
摇滚侠3 天前
java语言中,list<String>转成字符串,逗号分割;List<Integer>转字符串,逗号分割
java·windows·list
Source.Liu3 天前
【Pywinauto库】12.2 pywinauto.element_info 后端内部实施模块
windows·python·自动化
Source.Liu3 天前
【Pywinauto库】12.1 pywinauto.backend 后端内部实施模块
开发语言·windows·python·自动化
私人珍藏库3 天前
[Windows] FileOptimizer v17.1.0_一款文件批量压缩工具
windows·批量压缩
掘根3 天前
【CMake】List
windows·microsoft·list
TToolss3 天前
删除文件夹里的网盘图标
windows