{"id":323,"date":"2006-11-22T06:00:00","date_gmt":"2006-11-22T14:00:00","guid":{"rendered":"http:\/\/testblog.sapien.com\/index.php\/2006\/11\/22\/take-title-of-your-cli\/"},"modified":"2006-11-22T06:00:00","modified_gmt":"2006-11-22T14:00:00","slug":"take-title-of-your-cli","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2006\/11\/22\/take-title-of-your-cli\/","title":{"rendered":"Take Title of your CLI"},"content":{"rendered":"<p>If you have batch files that require a long time to run or would like to have an easy way to monitor the progress, here&#8217;s an easy way. By using the TITLE command, you can change the title of the command prompt window. When you minimize the window to the task bar, the title bar is displayed. If you change the title as your script progresses you can easily monitor it&#8217;s progress.<\/p>\n<p>Setting the text for the title bar is as simple as:<\/p>\n<p><span style=\"font-family: Courier New,Courier,mono;\">c:\\&gt; title Working&#8230;Please Wait<\/span><\/p>\n<p>Here&#8217;s a more practical example. Using FILEVER I can get some very specific version information about executables on my system. What I want is a space delimited file that I can open in Excel for further analysis and sorting. As you might imagine, this task might take a while to run. By using TITLE, I can modify the title bar to indicate what file the script is working on:<br \/><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">@echo off<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">::EXEVer.bat<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">::Create a space delimited file of all EXE files with version<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">::information from running FILEVER.EXE<\/span><br style=\"font-family: Courier New,Courier,mono;\"><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">set log=exeversions.log<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">REM clear the log file if it already exists<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">if exist %log% DEL %log% &gt;NUL<\/span><br style=\"font-family: Courier New,Courier,mono;\"><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">Title Working&#8230;<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">REM Build the file listing and use TITLE to display the status<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">for \/f &#8220;tokens=*&#8221; %%x in (&#8216;dir c:\\*.exe \/s \/b&#8217;) do @CALL :GetInfo &#8220;%%x&#8221;<\/span><br style=\"font-family: Courier New,Courier,mono;\"><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">Title Finished %0<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">Echo Results logged to %log%<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">Start Notepad %log%<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">set log=<\/span><br style=\"font-family: Courier New,Courier,mono;\"><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">GOTO :EOF<\/span><br style=\"font-family: Courier New,Courier,mono;\"><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">:GetInfo<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">Title Analyzing %1<\/span><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">for \/f &#8220;tokens=*&#8221; %%v in (&#8216;filever %1&#8217;) do @echo %1&nbsp; %%v &gt;&gt;%log%<\/span><br style=\"font-family: Courier New,Courier,mono;\"><br style=\"font-family: Courier New,Courier,mono;\"><span style=\"font-family: Courier New,Courier,mono;\">:EOF<\/span><\/p>\n<p>Unfortunately, the command window will retain the last title set so you&#8217;ll want to set it back to something like Windows Command Prompt when your script is finished if you are keeping the window open.<\/p>\n<p>Do you have any creative uses for TITLE?&nbsp; If so, I&#8217;d love to hear about them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have batch files that require a long time to run or would like to have an easy way to monitor the progress, here&#8217;s an easy way.By using the TITLE command, you can change the title of the command prompt window. When you minimize the window to the task bar, the title bar is displayed. If you change the title as your script progresses you can easily monitor it&#8217;s progress.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[18,2],"tags":[],"class_list":["post-323","post","type-post","status-publish","format-standard","hentry","category-batchcmd","category-general"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=323"}],"version-history":[{"count":0,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/323\/revisions"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}