ŵ[Ƶ̳]Ƶ̳[Ƶ̳]VBSƵ̳
[ļƷ]Ƭ[ļƷ]ߵ
б
UNC ѡ

JS
  1. <title>
  2.     EasyX v20120603(beta) װ
  3. </title>
  4. <script type="text/javascript">
  5.     function GetSystemVersion() {
  6.         var os = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem");
  7.         for (var e = new Enumerator(os); ! e.atEnd(); e.moveNext()) {
  8.             var v = e.item().Version;
  9.             var ss = v.split('.');
  10.             return ss[0] + ss[1];
  11.         }
  12.         return - 1;
  13.     }
  14.     if (GetSystemVersion() >= 60) {
  15.         var cmd = location.pathname;
  16.         if (cmd.substring(cmd.length - 4) != ".HTA") {
  17.             var Shell = new ActiveXObject("Shell.Application");
  18.             Shell.ShellExecute("mshta.exe", "\"" + cmd.substring(0, cmd.length - 4) + ".HTA\"", "", "runas", 1);
  19.             window.close();
  20.             exit(0);
  21.         }
  22.     }
  23. </script>
ƴ
ǧˮǧ¡ǧˮӳǧƣ졣    http://yu2n.qiniudn.com/

TOP

yu2n 2019-5-26 12:41 ༭

2019.05.26  ѸʱԴվΪʱԴ (Զ HTTP ޸Ĵе http://www.microsoft.com )

Win7x64 / Win10x64 ͨ
  1. 'VBSУ׼ϵͳʱ BY Yu2n  2019.05.26
  2. Option Explicit
  3. RunAsAdminX64
  4. Main
  5. '************************************************************************
  6. Sub Main()
  7. '************************************************************************
  8. Dim dtNet, dtLocal1, dtLocal2, lngOffset1, lngOffset2, strMessage
  9. dtNet = GetNetTime("http://www.microsoft.com")
  10. dtLocal1 = Now()
  11. lngOffset1 = Abs(DateDiff("s", dtNet, dtLocal1))
  12. If lngOffset1 > 1 Then
  13. SetDateTime dtNet
  14. dtLocal2 = Now()
  15. lngOffset2 = Abs(DateDiff("s", dtNet, dtLocal2))
  16. strMessage = "У׼ǰ" & vbCrLf _
  17. & "׼ʱΪ" & vbTab & dtNet & vbCrLf _
  18. & "ϵͳʱΪ" & vbTab & dtLocal1 & vbCrLf _
  19. & "׼ʱ" & vbTab & lngOffset1 & "" & vbCrLf & vbCrLf _
  20. & "У׼" & vbCrLf _
  21. & "׼ʱΪ" & vbTab & dtNet & vbCrLf _
  22. & "ϵͳʱΪ" & vbTab & dtLocal2 & vbCrLf _
  23. & "׼ʱ" & vbTab & lngOffset2 & ""
  24. Else
  25. strMessage =  "У׼" & vbCrLf _
  26. & "׼ʱΪ" & vbTab & dtNet & vbCrLf _
  27. & "ϵͳʱΪ" & vbTab & dtLocal1 & vbCrLf _
  28. & "׼ʱ" & vbTab & lngOffset1 & ""
  29. End If
  30. WScript.Echo strMessage
  31. End Sub
  32. '************************************************************************
  33. 'ȡָHTTPʱ
  34. '************************************************************************
  35. Function GetNetTime(ByVal Url)
  36.     Dim Bias, DateLine 'ʱƫƣӣ
  37.     Dim dtGMT, dtLocal, dtBegin
  38. On Error Resume Next
  39.     With CreateObject("WScript.Shell")
  40. '[ActiveTimeBias]:üֵ洢ǰϵͳʱԸα׼ʱƫƣԷΪλ
  41. '[Bias]:üֵ洢ǰʱԸα׼ʱƫƣԷΪλ
  42. Bias = .RegRead("HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias")
  43.     End With
  44.     With CreateObject("Microsoft.XMLHTTP")
  45. dtBegin = Now()
  46.     .Open "POST", Url, False
  47.     .Send
  48. If Err.Number = 0 Then
  49. dtGMT = Split(Replace(.getResponseHeader("Date"), " GMT", ""), ",")(1)
  50. If IsDate(dtGMT) Then
  51. dtLocal = DateAdd("n", -CLng(Bias), CDate(dtGMT)) 'ʱ䣺GMT+8
  52. dtLocal = DateAdd("s", DateDiff("s", dtBegin, Now()), dtLocal) 'ʱ
  53. GetNetTime = dtLocal
  54. End If
  55. End If
  56.     End With
  57. End Function
  58. '************************************************************************
  59. '趨Եʱ
  60. '************************************************************************
  61. Function SetDateTime(ByVal dt1)
  62. Dim WmiService, ComputerName, OSList, OSEnum, OS, DateTime
  63. ComputerName = "."
  64. Set WmiService = GetObject("winmgmts:{impersonationLevel=impersonate, (Systemtime)}!//" + ComputerName + "/root/cimv2")
  65. Set OSList = WmiService.InstancesOf ("Win32_OperatingSystem")
  66. Set DateTime = CreateObject("WbemScripting.SWbemDateTime")
  67. For Each OSEnum In OSList
  68. DateTime.Value = OSEnum.LocalDateTime
  69. DateTime.Year = Year(dt1)
  70. DateTime.Month = Month(dt1)
  71. DateTime.Day = Day(dt1)
  72. DateTime.Hours = Hour(dt1)
  73. DateTime.Minutes = Minute(dt1)
  74. DateTime.Seconds = Second(dt1)
  75. If (OSEnum.SetDateTime(DateTime.Value) <> 0) Then
  76. 'WScript.Echo "棺ϵͳʱʧܣ"
  77. SetDateTime = False
  78. Else
  79. 'WScript.Echo "ʾóɹǰʱ䣺" & DateTime.GetVarDate()
  80. SetDateTime = True
  81. End If
  82. Next
  83. End Function
  84. '************************************************************************
  85. 'ʼ RunAsAdminX64 For Win10 x64
  86. '************************************************************************
  87. Function RunAsAdminX64()
  88. Dim wso, fso, dwx, sSFN, sSD32, sSF32, vArg, sArgs, oShell, sDWX
  89. Set wso = CreateObject("WScript.Shell")
  90. Set fso = CreateObject("Scripting.filesystemobject")
  91. RunAsAdminX64 = False
  92. 'ȡ WSH
  93. For Each vArg In WScript.Arguments
  94. sArgs = sArgs & " " & """" & vArg & """"
  95. Next
  96. 'ȡ 32 λ WSH Ŀ¼
  97. sSFN = fso.GetFile(WScript.FullName).Name
  98. sSD32 = wso.ExpandenVironmentStrings("%windir%\SysWOW64")
  99. If Not fso.FileExists(sSD32 & "\" & sSFN ) Then
  100. sSD32 = wso.ExpandenVironmentStrings("%windir%\System32")
  101. End If
  102. ' 32 λ WSH
  103. If UCase(WScript.FullName) <> UCase(sSD32 & "\" & sSFN) Then
  104. wso.Run sSD32 & "\" & sSFN & " """ & WScript.ScriptFullName & """" & sArgs, 1, False
  105. WScript.Quit
  106. End If
  107. 'ԹԱȨ WSH
  108. If Not WScript.Arguments.Named.Exists("ADMIN") Then
  109. Set oShell = CreateObject("Shell.Application")
  110. oShell.ShellExecute WScript.FullName, """" & WScript.ScriptFullName & """ " & sArgs & " /ADMIN:1 ", "", "runas", 6
  111. WScript.Quit
  112. End If
  113. End Function
ƴ
ǧˮǧ¡ǧˮӳǧƣ졣    http://yu2n.qiniudn.com/

TOP

yu2n 2019-5-26 12:41 ༭

2019.05.26  ѸʱԴվΪʱԴ (Զ HTTP ޸Ĵе http://www.microsoft.com )

Js Ҳˡ
  1. //ļƣSyncNetTime2.js
  2. //˵ͬʱʱ
  3. //ʹ÷Cscript.exe //nologo SyncNetTime.js
  4. //Իϵͳ Win10 x64 ʱ 18/1/15 û Yu2n
  5. //ݣFix ȡʱ䣬 HTTP SERVER HEADER
  6. //ԹԱ
  7. function GetSystemVersion() {
  8. var os = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem");
  9. for (var e = new Enumerator(os); ! e.atEnd(); e.moveNext()) {
  10. var v = e.item().Version;
  11. var ss = v.split('.');
  12. return ss[0] + ss[1];
  13. }
  14. return - 1;
  15. }
  16. if (GetSystemVersion() >= 60) {
  17. var cmd = WScript.ScriptFullName;
  18. if (cmd.substring(cmd.length - 3) != ".jS") {
  19. var Shell = new ActiveXObject("Shell.Application");
  20. Shell.ShellExecute("wscript.exe", "\"" + cmd.substring(0, cmd.length - 3) + ".jS\"", "", "runas", 1);
  21. WScript.Quit(0);
  22. }
  23. }
  24. //ȡʱ䣬 HTTP SERVER HEADER
  25. var getNetDate = function() {
  26. var dtGMT = '';
  27. try{
  28. var http = new ActiveXObject("Microsoft.XMLHTTP");
  29. http.open("POST", "http://www.microsoft.com?rnd=" + (new Date()), false);
  30. http.send();
  31. dtGMT = http.getResponseHeader("Date");
  32. if (dtGMT != '') {
  33. return new Date(dtGMT);
  34. } else {
  35. WScript.Echo("棺ȡʱʧܣ")
  36. WScript.Quit(0);
  37. };
  38. }catch(e){};
  39. };
  40. //ʱ
  41. function ChangeDate()
  42. {
  43. var WmiService, ComputerName, OSList, OSEnum, OS, DateTime;
  44. ComputerName = ".";
  45. WmiService = GetObject ("winmgmts:{impersonationLevel=impersonate, (Systemtime)}!//" + ComputerName + "/root/cimv2");
  46. OSList = WmiService.InstancesOf ("Win32_OperatingSystem");
  47. DateTime = new ActiveXObject ("WbemScripting.SWbemDateTime");
  48. OSEnum = new Enumerator (OSList);
  49. for ( ; !OSEnum.atEnd(); OSEnum.moveNext())
  50. {
  51. OS = OSEnum.item();
  52. var dtNewDate = getNetDate(); //ȡʱ
  53. DateTime.Value = OS.LocalDateTime;
  54. DateTime.Year = dtNewDate.getFullYear();
  55. DateTime.Month = dtNewDate.getMonth() + 1;
  56. DateTime.Day = dtNewDate.getDate();
  57. DateTime.Hours = dtNewDate.getHours();
  58. DateTime.Minutes = dtNewDate.getMinutes();
  59. DateTime.Seconds = dtNewDate.getSeconds();
  60. if (OS.SetDateTime(DateTime.Value) != 0) {
  61. WScript.Echo("棺ϵͳʱʧܣ");
  62. } else {
  63. WScript.Echo("ʾóɹǰʱ䣺" + new Date(DateTime.GetVarDate()).toLocaleString());
  64. };
  65. }
  66. }
  67. ChangeDate();
  68. WScript.Quit(0);
ƴ
ǧˮǧ¡ǧˮӳǧƣ졣    http://yu2n.qiniudn.com/

TOP

ظ 13# citygun


    ѸʱԴվΪʱԴ
ǧˮǧ¡ǧˮӳǧƣ졣    http://yu2n.qiniudn.com/

TOP

б