{"id":6501,"date":"2015-10-06T10:44:47","date_gmt":"2015-10-06T08:44:47","guid":{"rendered":"http:\/\/dollarunderscore.azurewebsites.net\/?p=6501"},"modified":"2016-09-06T22:48:46","modified_gmt":"2016-09-06T20:48:46","slug":"how-many-cmdlet-characters-per-minute-can-you-type","status":"publish","type":"post","link":"https:\/\/p0wershell.com\/?p=6501","title":{"rendered":"How many cmdlet-characters per minute can you type?"},"content":{"rendered":"<p>So, there are a lot of PowerShell &#8220;scripting games&#8221; around recently, which is great. But are they <em>really<\/em> games? \ud83d\ude09<\/p>\n<p>Let&#8217;s do something a bit different, let&#8217;s measure how fast we can type out cmdlet names!<\/p>\n<p>Tab completion cannot be used, and the input will be compared in a case sensitive way (yes, I know, this is by no means a measure on how good your PowerShell skills are, like, at all. But hey, it&#8217;s just a game \ud83d\ude42 ), the code for the function that can measure this follows (<a href=\"https:\/\/p0wershell.com\/wp-content\/uploads\/2015\/10\/Measure-CmdletTypingSpeed.txt\" target=\"_blank\">download link<\/a>):<\/p>\n<p>[PowerShell]<br \/>\nfunction Measure-CmdletTypingSpeed {<\/p>\n<p>    <#\n    .SYNOPSIS\n    Measure the speed and accuracy of typing cmdlet-names.\n\n    .DESCRIPTION\n    This function will load a number of random cmdlets from the ones available on\n    the local system and measure the speed and accuracy of how they are typed.\n\n    The input and cmdlet names are compared with case sensitivity.\n\n    Yes, this is quite stupid since we all use tab completion \"in real life\", but\n    this is just meant as a game, so try not to get too upset!\n\n    .EXAMPLE\n    Measure-CmdletTypingSpeed\n\n    Runs this function.\n\n    .EXAMPLE\n    Measure-CmdletTypingSpeed -NumberOfCmdlets 20\n\n    Runs this function. Will load 20 cmdlets that needs to be typed. (Default is 10)\n\n    .PARAMETER NumberOfCmdlets\n    Specify how many cmdlets you want to type before the result is posted. Default\n    and minimum is 10, maximum 100.\n    \n    #><\/p>\n<p>    [cmdletbinding()]<br \/>\n    Param(<br \/>\n        [ValidateRange(10,100)]<br \/>\n        [int] $NumberOfCmdlets = 10)<\/p>\n<p>    # Load a selection of random commands<br \/>\n    $Commands = Get-Command | Where-Object { $_.CommandType -eq &#8216;Cmdlet&#8217; } | Get-Random -Count $NumberOfCmdlets<\/p>\n<p>    # Initialize the arrays<br \/>\n    $CorrectlyTypedCommands = @()<br \/>\n    $IncorrectlyTypedCommands = @()<\/p>\n<p>    $StartTime = Get-Date<\/p>\n<p>    # Time to loop through the commands and ask for input<br \/>\n    foreach ($Command in $Commands) {<br \/>\n        $Result = Read-Host -Prompt &#8220;Type command: $($Command.Name)&#8221;<\/p>\n<p>        if ($Command.Name -ceq $Result) {<br \/>\n            $CorrectlyTypedCommands += $Command.Name<br \/>\n        }<br \/>\n        else {<br \/>\n            $IncorrectlyTypedCommands += $Command.Name<br \/>\n        }<br \/>\n    }<\/p>\n<p>    $EndTime = Get-Date<\/p>\n<p>    # Calculate the time it took<br \/>\n    $TimeSpan = New-TimeSpan -Start $StartTime -End $EndTime<\/p>\n<p>    # Figure out the length (number of characters) of the correctly typed commands<br \/>\n    $LengthOfAllCorrectlyTypedCommands = $CorrectlyTypedCommands | ForEach-Object { $_.ToCharArray() } | Measure-Object | Select-Object -ExpandProperty Count<\/p>\n<p>    # Calculate the results<br \/>\n    $CmdletCharactersPerMinute = [Math]::Round($LengthOfAllCorrectlyTypedCommands\/$TimeSpan.TotalMinutes)<br \/>\n    $CmdletsPerMinute = [Math]::Round($CorrectlyTypedCommands.Count\/$TimeSpan.TotalMinutes)<br \/>\n    $Accuracy = [Math]::Round($CorrectlyTypedCommands.Count\/$Commands.count*100)<\/p>\n<p>        Write-Verbose &#8220;Your manage to type $CmdletCharactersPerMinute cmdlet-characters per minute ($CmdletsPerMinute cmdlets\/minute). You typed $Accuracy% of the cmdlets correctly!&#8221;<\/p>\n<p>        $TypeSpeedResults = New-Object System.Object<br \/>\n        $TypeSpeedResults | Add-Member -Type NoteProperty -Name CmdletCharactersPerMinute -Value $CmdletCharactersPerMinute<br \/>\n        $TypeSpeedResults | Add-Member -Type NoteProperty -Name CmdletsPerMinute -Value $CmdletsPerMinute<br \/>\n        $TypeSpeedResults | Add-Member -Type NoteProperty -Name TotalLengthTypedCorrectly -Value $LengthOfAllCorrectlyTypedCommands<br \/>\n        $TypeSpeedResults | Add-Member -Type NoteProperty -Name Accuracy -Value $Accuracy<br \/>\n        $TypeSpeedResults | Add-Member -Type NoteProperty -Name MisspelledCmdletNames -Value $IncorrectlyTypedCommands<\/p>\n<p>        Write-Output $TypeSpeedResults<br \/>\n}<br \/>\n[\/PowerShell]<\/p>\n<p><a href=\"https:\/\/p0wershell.com\/wp-content\/uploads\/2015\/10\/Measure-CmdletTypingSpeed.txt\" target=\"_blank\"><strong><em>Download as txt-file.<\/em><\/strong><\/a><\/p>\n<p>Screenshot of it in action:<br \/>\n<a href=\"https:\/\/p0wershell.com\/wp-content\/uploads\/2015\/10\/CmdletTypingSpeedDump.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/p0wershell.com\/wp-content\/uploads\/2015\/10\/CmdletTypingSpeedDump.png\" alt=\"CmdletTypingSpeedDump\" width=\"1304\" height=\"512\" class=\"alignnone size-full wp-image-6541\" srcset=\"https:\/\/p0wershell.com\/wp-content\/uploads\/2015\/10\/CmdletTypingSpeedDump.png 1304w, https:\/\/p0wershell.com\/wp-content\/uploads\/2015\/10\/CmdletTypingSpeedDump-300x118.png 300w, https:\/\/p0wershell.com\/wp-content\/uploads\/2015\/10\/CmdletTypingSpeedDump-1024x402.png 1024w, https:\/\/p0wershell.com\/wp-content\/uploads\/2015\/10\/CmdletTypingSpeedDump-624x245.png 624w\" sizes=\"(max-width: 1304px) 100vw, 1304px\" \/><\/a><\/p>\n<p>Feel free to post suggestions on improving it. And if you want to, share your results in the comments! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, there are a lot of PowerShell &#8220;scripting games&#8221; around recently, which is great. But are they really games? \ud83d\ude09 Let&#8217;s do something a bit different, let&#8217;s measure how fast we can type out cmdlet names! Tab completion cannot be used, and the input will be compared in a case sensitive way (yes, I know, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[21],"tags":[1211,1221],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3Zj0A-1GR","_links":{"self":[{"href":"https:\/\/p0wershell.com\/index.php?rest_route=\/wp\/v2\/posts\/6501"}],"collection":[{"href":"https:\/\/p0wershell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p0wershell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p0wershell.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p0wershell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6501"}],"version-history":[{"count":0,"href":"https:\/\/p0wershell.com\/index.php?rest_route=\/wp\/v2\/posts\/6501\/revisions"}],"wp:attachment":[{"href":"https:\/\/p0wershell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p0wershell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p0wershell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}