header image

Start-Sleep change

Posted by: | January 31, 2019 Comments Off on Start-Sleep change |

Start-Sleep change in PowerShell v6.2 preview 4

Start-Sleep has had this syntax

Start-Sleep [-Seconds] <int> [<CommonParameters>]

Start-Sleep -Milliseconds <int> [<CommonParameters>]


since it was first introduced in PowerShell v1 (I think).

You can define the period as a number of seconds or use the –Milliseconds option if you need a fraction of a second.


In PowerShell v6.2 preview 4 this changes to

Start-Sleep [-Seconds] <double> [<CommonParameters>]

Start-Sleep -Milliseconds <int> [<CommonParameters>]


so you can use

Start-Sleep -Seconds 3.5


If you try the command in Windows PowerShell v5.1 or PowerShell v6.1 it will work but I suspect that the 3.5 is converted to an integer so you don’t get the correct delay.

under: PowerShell v6

Comments are closed.