Created
July 25, 2022 03:15
-
-
Save lxfly2000/f4801fe857c4484e83823afffff783d2 to your computer and use it in GitHub Desktop.
检查微软操作系统的支持状态
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//注意文本编码应为ANSI | |
var enddates=[ | |
{os:"Windows XP",date:"2014/4/8"}, | |
{os:"Windows Vista",date:"2017/4/11"}, | |
{os:"Windows 7",date:"2023/1/14"}, | |
{os:"Windows 8.1",date:"2023/1/10"}, | |
{os:"Windows 8",date:"2016/1/12"}, | |
{os:"Windows 10",date:"2025/10/14"}]; | |
var osname=new Enumerator(GetObject("winmgmts:").ExecQuery("SELECT * FROM Win32_OperatingSystem")).item().Caption; | |
for(var i=0;i<enddates.length;i++){ | |
if(osname.search(enddates[i].os)!=-1){ | |
break; | |
} | |
} | |
var wsh=new ActiveXObject("WScript.Shell"); | |
if(i>=enddates.length){ | |
var msg="未知的操作系统。"; | |
}else{ | |
var today=new Date().getTime(); | |
var eosday=new Date(enddates[i].date).getTime(); | |
var leftdays=parseInt((eosday-today)/1000/60/60/24); | |
if(leftdays<0){ | |
var msg=osname+" 支持已结束。"; | |
}else{ | |
var msg="距 "+osname+" 支持结束还有 "+leftdays+" 天。"; | |
} | |
} | |
wsh.PopUp(msg,10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment