{"id":10541,"date":"2006-04-25T12:18:24","date_gmt":"2006-04-25T12:18:24","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2006\/04\/25\/write-progress\/"},"modified":"2019-02-18T13:24:54","modified_gmt":"2019-02-18T20:24:54","slug":"write-progress","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/write-progress\/","title":{"rendered":"Write-Progress"},"content":{"rendered":"<p>Tony&nbsp;has a very cool series of Monad-oriented blog entries at: <a href=\"http:\/\/mshforfun.blogspot.com\/\">http:\/\/mshforfun.blogspot.com\/<\/a>&nbsp;.&nbsp; I was fascinated by this one: <a href=\"http:\/\/mshforfun.blogspot.com\/2005\/12\/ncbi-blastn-under-msh-command-line.html\">http:\/\/mshforfun.blogspot.com\/2005\/12\/ncbi-blastn-under-msh-command-line.html<\/a>&nbsp; which exposes the NCBI BLAST tool via a command line.&nbsp; Tony&#8217;s log explains what this tool does but what I found so cool was that it submitted a query for a Website, waited for results, retrived those results and then displayed them.<\/p>\n<p>Tony&#8217;s script is&nbsp;a&nbsp;rewrite&nbsp;of a Perl Script using traditional concepts.&nbsp; In particular, it outputs error, progress, and results all to the same channel on the console.&nbsp; I did a light rewrite of the script to leverage Monad ability to put this information into different channels.&nbsp; In particular, progress information can be displayed in a Console ProgressBar via Write-Progress.&nbsp;&nbsp; This is the preferred way to display this information.&nbsp; It provides a much better user experience and it forces you to think about what information you should be providing the user to set their expectations.&nbsp; The other cool thing is that these Progress records are also available to GUI hosts so if this script where hosted in a GUI, it could use a GUI progressBar.<\/p>\n<p>Run the original script and then try this one and compare the difference.&nbsp; <\/p>\n<p>I&#8217;ve attached the script.<\/p>\n<p>Jeffrey P. Snover<br \/>Monad Architect<\/p>\n<p>[<i>Edit: Monad has now been renamed to Windows PowerShell.  This script or discussion may require slight adjustments before it applies directly to newer builds.<\/i>]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tony&nbsp;has a very cool series of Monad-oriented blog entries at: http:\/\/mshforfun.blogspot.com\/&nbsp;.&nbsp; I was fascinated by this one: http:\/\/mshforfun.blogspot.com\/2005\/12\/ncbi-blastn-under-msh-command-line.html&nbsp; which exposes the NCBI BLAST tool via a command line.&nbsp; Tony&#8217;s log explains what this tool does but what I found so cool was that it submitted a query for a Website, waited for results, retrived those [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-10541","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>Tony&nbsp;has a very cool series of Monad-oriented blog entries at: http:\/\/mshforfun.blogspot.com\/&nbsp;.&nbsp; I was fascinated by this one: http:\/\/mshforfun.blogspot.com\/2005\/12\/ncbi-blastn-under-msh-command-line.html&nbsp; which exposes the NCBI BLAST tool via a command line.&nbsp; Tony&#8217;s log explains what this tool does but what I found so cool was that it submitted a query for a Website, waited for results, retrived those [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/10541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=10541"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/10541\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=10541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=10541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=10541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}