经典ASP-使用Powershell显示时区列表 [英] Classic ASP - Display List of Timezones using powershell

查看:196
本文介绍了经典ASP-使用Powershell显示时区列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何,仍使用powershell GET-Timezone -ListAvailble显示系统时区.我的要求是在ASP页的下拉列表中显示此内容.现在对我来说,使用.net com甚至对于SQL Server sys.time_zone_info都不是一个选择.

Is there anyway to display system timezone using powershell GET-Timezone -ListAvailble. My requirements is to display this in a dropdownlist in an ASP page. Using .net com is not an option for me now, and even SQL server sys.time_zone_info.

推荐答案

您可以使用 Shell.Exec 调用powershell命令并从标准输出中读取.

You could use Shell.Exec to call the powershell command and read from the standard output.

强大的功能部分来自 Lee_Dailey的答案

<%
Set objShell = server.CreateObject("WScript.Shell")
Set objExec = objShell.Exec("cmd /c powershell [System.TimeZoneInfo]::GetSystemTimeZones().DisplayName")
Set objStdOut = objExec.StdOut


Response.write "<select name=""Timezones"">"

While Not objStdOut.AtEndOfStream
   Response.write "<option>" & objStdOut.ReadLine & "</option>"
Wend

Response.write "</select>"

%>

这篇关于经典ASP-使用Powershell显示时区列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆