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博客
相关推荐
张赐荣1 天前
深入详解在 Python 中用 ctypes 调用 Windows API 清空回收站
开发语言·windows·python
2501_939998201 天前
Antimalware Service Executable 占用率极高怎么关闭
windows
万粉变现经纪人1 天前
如何解决 pip install bitsandbytes 报错 仅支持 Linux+glibc(macOS/Windows 失败)问题
linux·运维·windows·python·scrapy·macos·pip
嵌入式Q1 天前
FreeRTOS源码解析(2)任务挂起与恢复
windows
Hello.Reader1 天前
Windows C 盘空间告急?用 PowerShell 写一个安全可控的清理脚本
c语言·windows·安全
阿洛学长1 天前
OpenClaw零成本部署指南:Windows/Mac/Linux/阿里云搭建+两个免费大模型API配置攻略
linux·windows·macos
嵌入式Q1 天前
FreeRTOS源码解析(2)任务调度器挂起与恢复
windows
飘飘叶1 天前
[FRP]Windows 安装 frpc 客户端,以及P2P方式ssh配置
windows·frp
承渊政道1 天前
用群晖部署OmniBox+pansou:把分散的影视资源全聚合到一个界面里
服务器·windows·网络协议·https·ip·视频·持续部署
阿昭L1 天前
Windows中的I/O完成通知与事件内核对象
windows·多线程