{"id":31383,"date":"2006-04-27T10:00:21","date_gmt":"2006-04-27T10:00:21","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2006\/04\/27\/a-new-scripting-language-doesnt-solve-everything\/"},"modified":"2006-04-27T10:00:21","modified_gmt":"2006-04-27T10:00:21","slug":"a-new-scripting-language-doesnt-solve-everything","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20060427-21\/?p=31383","title":{"rendered":"A new scripting language doesn&#039;t solve everything"},"content":{"rendered":"<p>\nYes, there are plenty of scripting languages that are much\nbetter than boring old batch.\nBatch files were definitely a huge improvement over <code>SUBMIT<\/code>\nback in 1981,\nbut they&#8217;ve been showing their age for quite some time.\nThe advanced age of boring old batch, on the other hand, means that you have\nmillions of batch files out there that you had better not break if you\nknow what&#8217;s good for you.\n(Sure, in retrospect, you might decide to call the batch language\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/09\/09\/462906.aspx#463547\">\na design mistake<\/a>,\nbut remember that it had to run in 64KB\nof memory on a 4.77MHz machine while still remaining compatible in\nspirit with CP\/M.)\n<\/p>\n<p>\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/09\/09\/462906.aspx#463052\">\nShipping a new command shell<\/a>\ndoesn&#8217;t solve everything either.\nFor one thing,\nyou have to decide if you are going to support classic batch files or not.\nMaybe you decide that you won&#8217;t and prefer to\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/03\/22\/558007.aspx\">\nforce people to rewrite all their\nbatch files into your new language<\/a>.\nGood luck on that.\n<\/p>\n<p>\nOn the other hand, if you decide that you will support batch files after all,\nthen\npresumably your new command shell will not execute old batch files\nnatively, but rather will defer to <code>CMD.EXE<\/code>.\nAnd there&#8217;s your problem:\nYou see, batch files have the ability to modify environment\nvariables and have the changes persist beyond\nthe end of the batch file.\nTry it:\n<\/p>\n<pre>\nC&gt; copy <a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2003\/10\/22\/55388.aspx\">con<\/a> marco.cmd\n@set MARCO=polo\n^Z\n        1 file(s) copied.\nC&gt; echo %MARCO%\n%MARCO%\nC&gt; marco\nC&gt; echo %MARCO%\npolo\n<\/pre>\n<p>\nIf your new command shell defers to <code>CMD.EXE<\/code>,\nthese environment changes won&#8217;t propagate back to your command\nshell since the batch file modifies the environment variables\nof <code>CMD.EXE<\/code>, not your shell.\nMany organizations have a system of batch files that\nrely on the ability to pass parameters\nbetween scripts by stashing them into environment variables.\nThe DDK&#8217;s own <code>razzle<\/code>\ndoes this, for example, in order to establish a consistent build\nenvironment and pass information to <code>build.exe<\/code>\nabout what kind of build you&#8217;re making.\nAnd I bet you have a batch file or two that sets your <code>PROMPT<\/code>\nor <code>PATH<\/code> environment variable or changes your current\ndirectory.\n<\/p>\n<p>\nSo good luck with your replacement command shell.\nI hope you figure out how to run batch files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, there are plenty of scripting languages that are much better than boring old batch. Batch files were definitely a huge improvement over SUBMIT back in 1981, but they&#8217;ve been showing their age for quite some time. The advanced age of boring old batch, on the other hand, means that you have millions of batch [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-31383","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Yes, there are plenty of scripting languages that are much better than boring old batch. Batch files were definitely a huge improvement over SUBMIT back in 1981, but they&#8217;ve been showing their age for quite some time. The advanced age of boring old batch, on the other hand, means that you have millions of batch [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=31383"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31383\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=31383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=31383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=31383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}