{"id":2413,"date":"2017-07-15T13:56:45","date_gmt":"2017-07-15T13:56:45","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=2413"},"modified":"2019-03-16T17:41:42","modified_gmt":"2019-03-16T17:41:42","slug":"batch-script-basics","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/batch-script-basics\/","title":{"rendered":"Batch Script Basics"},"content":{"rendered":"<p>System Path is one which comes when you type cmd in windows->run<br \/>\nOther simple commands are dir,ver,cls<\/p>\n<p><strong>Storing Variable Name<\/strong><\/p>\n<pre>\r\n>>set strName=Mugil\r\n>>echo  %strName%\r\n<\/pre>\n<p><strong>Typing set and pressing enter will return system variable<\/strong><\/p>\n<pre>\r\n>>set\r\n<\/pre>\n<p><strong>To check for List of Users type<\/strong><\/p>\n<pre>\r\n>>set USER\r\n<\/pre>\n<p><strong>String Cancatenation<\/strong><\/p>\n<pre>\r\n>>set strFirstName=Mugil\r\n>>set strFirstName=%strFirstName% Vannan\r\n<\/pre>\n<p><strong>Displays Volumne Info<\/strong><\/p>\n<pre>\r\n>>vol D:\r\n>>dir \/B\r\n<\/pre>\n<p>Get option of Util<br \/>\n>>dir \/?<br \/>\n>>cls \/?<\/p>\n<p><strong>Lists folder in Dir with details<\/strong><\/p>\n<pre>\r\n>>dir\r\n<\/pre>\n<p>Lists folder in Dir without details<\/p>\n<pre>\r\n>>dir \/B\r\n<\/pre>\n<p>Turn off the command executed in Screen<\/p>\n<pre>\r\n>>echo off\r\n<\/pre>\n<p>Turn off the Display of Batch Statements when Echo off command activated(Works for Script)<\/p>\n<pre>\r\n>>@echo off\r\n<\/pre>\n<p>\/A tag will allow us to work with mathematical operation<\/p>\n<pre>\r\n>>Set \/A\r\n<\/pre>\n<p>\/P tag will allow user inputs by prompting msg<\/p>\n<pre>\r\n>>Set \/P\r\n<\/pre>\n<p><b>Getting Inputs from Console<\/b><\/p>\n<pre>\r\n@echo off\r\n\r\nset \/p name=Please Enter your name\r\n\r\necho.\r\necho Your name is - %name%\r\n\r\npause\r\n<\/pre>\n<p><b>Labels(Organize code pieces)<\/b><\/p>\n<pre>\r\n:label\r\n<\/pre>\n<p><b>Goto(Jumps to Label and starts execution)<\/b><\/p>\n<pre>\r\ngoto :label\r\n<\/pre>\n<p><b>Comments<\/b><\/p>\n<pre>\r\nrem this is comment\r\n:: this is again a comment\r\n<\/pre>\n<p><b>Functions<\/b><\/p>\n<pre>\r\n:getSum\r\n   echo The Sum is Addition of Two Numbers\r\ngoto :eof\t \r\n<\/pre>\n<p><b>Calling Functions within function<\/b><\/p>\n<pre>\r\n:getMath\r\n\techo Calling Sum Function\r\n\tcall :getSum\t\r\ngoto :eof\r\n\r\n:getSum\r\n   echo The Sum is Addition of Two Numbers\r\ngoto :eof\t \r\n<\/pre>\n<p><b>Functions that takes Argument<\/b><\/p>\n<pre>\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>System Path is one which comes when you type cmd in windows->run Other simple commands are dir,ver,cls Storing Variable Name >>set strName=Mugil >>echo %strName% Typing set and pressing enter will return system variable >>set To check for List of Users type >>set USER String Cancatenation >>set strFirstName=Mugil >>set strFirstName=%strFirstName% Vannan Displays Volumne Info >>vol D:&hellip; <a href=\"https:\/\/codethataint.com\/blog\/batch-script-basics\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[270],"tags":[],"class_list":["post-2413","post","type-post","status-publish","format-standard","hentry","category-shell-scripting"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/2413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=2413"}],"version-history":[{"count":4,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/2413\/revisions"}],"predecessor-version":[{"id":2417,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/2413\/revisions\/2417"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=2413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=2413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=2413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}