我正在尝试创建一个任务,它将通过powershell无限期地每5分钟重复一次.但是,通过我所有的搜索,我无法想出办法.New-TimeSpan -Days 9999似乎是最大值,无论我做什么,我都没有时间超过9999天.这是触发器:
$trigger = New-ScheduledTaskTrigger -Once -At $date -RepetitionDuration (New-TimeSpan -Days 9999) -RepetitionInterval (New-TimeSpan -Minutes 5)
$PSVersionTable.PSVersion 报告我认为是v4,这是输出:
Major Minor Build Revision
4 0 -1 -1
当我第一次收到'mwindow'时,我做对了.但是,如果我错了一次或多次,即使我最终得到它也总是得到"无".
def windows():
print('\n---Maintenence Window Config---\n')
mwdate = input('Enter the date for the maintenance window (3 letters, Mon, Tue, Wed, etc.) : ')
if len(mwdate) > 3 or len(mwdate) < 3:
print('Error, date must be 3 characters in length.')
windows()
else:
mwstart = input('Enter the time in 24h format for the beginning of the maintenance window (e.x. 04:00): ')
mwend = input('Enter the ending time of the maintenance window in 24h format (e.x. 04:30): ')
if int((mwstart and mwend).replace(':','')) < …Run Code Online (Sandbox Code Playgroud)