Last active
August 26, 2022 16:58
-
-
Save biosmanager/7ad461508f80feb16f02d75619c35b95 to your computer and use it in GitHub Desktop.
Revisions
-
biosmanager revised this gist
Aug 26, 2022 . No changes.There are no files selected for viewing
-
biosmanager created this gist
Jul 31, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ param ( $StartTime = '09:00', $EndTime = '18:00', $DaysOff = @('Saturday', 'Sunday') ) $StartTimeDate = Get-Date $StartTime $EndTimeDate = Get-Date $EndTime $Date = Get-Date if ($Date.DayOfWeek -notin $DaysOff -and (($Date.TimeOfDay -ge $StartTimeDate.TimeOfDay) -and ($Date.TimeOfDay -le $EndTimeDate.TimeOfDay))) { # Autostart Write-Output 'Another day, another dollar!' Start-Process '<program1>' -RedirectStandardOutput nul Start-Process '<program2>' -RedirectStandardOutput nul } else { Write-Output 'Enjoy your freetime :)' }