{"id":31313,"date":"2006-05-04T10:00:13","date_gmt":"2006-05-04T10:00:13","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2006\/05\/04\/doing-quick-arithmetic-from-the-command-prompt\/"},"modified":"2006-05-04T10:00:13","modified_gmt":"2006-05-04T10:00:13","slug":"doing-quick-arithmetic-from-the-command-prompt","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20060504-13\/?p=31313","title":{"rendered":"Doing quick arithmetic from the command prompt"},"content":{"rendered":"<p>\nThe command processor <code>CMD.EXE<\/code> comes with a mini-calculator\nthat can perform simple arithmetic on 32-bit signed integers:\n<\/p>\n<pre>\nC:\\&gt;set \/a 2+2\n4\nC:\\&gt;set \/a 2*(9\/2)\n8\nC:\\&gt;set \/a (2*9)\/2\n9\nC:\\&gt;set \/a \"31&gt;&gt;2\"\n7\n<\/pre>\n<p>\nNote that we had to quote the shift operator since it would\notherwise be misinterpreted as a &#8220;redirect stdout and append&#8221; operator.\n<\/p>\n<p>\nFor more information, type\n<span STYLE=\"border: solid .75pt black;padding: .25ex\"><code>set \/?<\/code><\/span> at the command prompt.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The command processor CMD.EXE comes with a mini-calculator that can perform simple arithmetic on 32-bit signed integers: C:\\&gt;set \/a 2+2 4 C:\\&gt;set \/a 2*(9\/2) 8 C:\\&gt;set \/a (2*9)\/2 9 C:\\&gt;set \/a &#8220;31&gt;&gt;2&#8243; 7 Note that we had to quote the shift operator since it would otherwise be misinterpreted as a &#8220;redirect stdout and append&#8221; operator. [&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":[104],"class_list":["post-31313","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-tipssupport"],"acf":[],"blog_post_summary":"<p>The command processor CMD.EXE comes with a mini-calculator that can perform simple arithmetic on 32-bit signed integers: C:\\&gt;set \/a 2+2 4 C:\\&gt;set \/a 2*(9\/2) 8 C:\\&gt;set \/a (2*9)\/2 9 C:\\&gt;set \/a &#8220;31&gt;&gt;2&#8243; 7 Note that we had to quote the shift operator since it would otherwise be misinterpreted as a &#8220;redirect stdout and append&#8221; operator. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31313","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=31313"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31313\/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=31313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=31313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=31313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}