虽然从技术上讲,这不是你想要的答案,但我已经决定把它作为一个想法添加进去。
这是一个独立的批处理文件,旨在提供一个供最终用户选择的gui日历。它使用powershell,据我所知,它应该与windows 7(即powershell 2.0)一起使用。
<# :DSel
@Echo Off
Set "_="&For /F Delims^=^ EOL^= %%A In ('PowerShell -NoP -C^
"IEx([IO.File]::ReadAllText('%~f0'))"') Do Set "_=%%A"
If Not Defined _ GoTo DSel
Echo You selected %_%
Pause
Exit /B
#>
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$form = New-Object Windows.Forms.Form
$form.Text = 'Select a date'
$form.Size = New-Object Drawing.Size @(243,230)
$form.StartPosition = 'CenterScreen'
$calendar = New-Object System.Windows.Forms.MonthCalendar
$calendar.ShowTodayCircle = $false
$calendar.MaxDate = ((Get-Date).AddYears(5)).AddDays(-1)
$calendar.MinDate = Get-Date
$calendar.MaxSelectionCount = 1
$form.Controls.Add($calendar)
$OKButton = New-Object System.Windows.Forms.Button
$OKButton.Location = New-Object System.Drawing.Point(38,165)
$OKButton.Size = New-Object System.Drawing.Size(75,23)
$OKButton.Text = 'OK'
$OKButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
$form.AcceptButton = $OKButton
$form.Controls.Add($OKButton)
$CancelButton = New-Object System.Windows.Forms.Button
$CancelButton.Location = New-Object System.Drawing.Point(113,165)
$CancelButton.Size = New-Object System.Drawing.Size(75,23)
$CancelButton.Text = 'Today'
$CancelButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
$form.CancelButton = $CancelButton
$form.Controls.Add($CancelButton)
$form.ControlBox = $false
$form.Topmost = $true
$result = $form.ShowDialog()
if ($result -eq [System.Windows.Forms.DialogResult]::OK)
{
$date = $calendar.SelectionStart
Write-Host $($date.ToString('MM-dd-yyyy'))
}
正如你所建议的,你对powershell有一定的了解,你可以对powershell做任何必要的修改。