Batch Script For User Input in Variable

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys so far we have completed five different baskets so let's see what is there next we are going to learn about user input how do you get a user input and let's read a user story it would be very interesting to design this requirement a gathering is scheduled for this coming Sunday we wanted to welcome people to the event with their names and display them on a giant screen so there is a big screen on the event and anybody who is entering right so there'll be somebody who will be capturing the names the moment it is captured it should be displayed on a big screen welcome let's say Rakesh so Rakesh welcome to the event something like that okay so how that can be designed write a script which will take first name as a user input and grade them with a predefined sentence you got it so that is the requirement so let's see how this can be designed this would be pretty interesting so let's get started now yesterday in the video we have learned how to install the notepad plus plus right so today we are going to really use it and design some code so first of all what you do open a new file file new okay and then we are going to save it file uh save us and we will maintain in the same basket folder let's go to the bus script and then let's give it a name so this is the sixth one right so zero six and this is about great people or let's say let's keep it as a user input okay user input underscore great okay so let's quick let's we are going to uh I did a mistake I have to save it as a DOT b80 right I did not do that let me try again file savers zero six user underscore input underscore uh greet dot bat yeah okay so the file is ready now it will be interesting how we can design it okay so let's start so the very first thing I will write is Echo of fine and then I have to grid so I have to first take the user input now to take the user input how how can we really take the use input for that all you have to do is simply say set set slash P P is for prompt okay I'll teach you how it is working and then I will say input you can use any variable doesn't matter as an input and then I will say enter the name okay no codes are required and these are not case sensitive so I'll go enter the name so now the value will be there in the input variable what I want to do I want to really see if the if this is working or not okay set Echo um which I will say um percentage I want to fetch that input percentage and then I want to greet the user so how would I like to greet um after this I will say comma space and I will say we are delighted delighted to have you in at the event is that is that a good good sentence okay so we are delighted to have you at the event okay this is what I want to say and let's see if this one is working there'll be so many problems here okay this is not done there are so many things so let's see so let me save it and go to the bash script and run it okay so what is happening enter the name and uh let me say see it is coming very close to that I want to correct it Rakesh Rakesh we are delighted to have you at the event so it is printing but there are so many mistakes in this design right so you see there's no space here name request it is typing and I'm not happy and if I hit on enter it is creating close it should repeat right one more user will come again you have to open it so it is not completely done so what should we do so this is fine so here what I will do I'll give it a space here okay um and sorry not here enter the name after that I'll put a colon Mark and give it a space so that space will appear fine I wanted to repeat again and again again and again it should clear the screen and repeat so for that what I will do first of all we will use something called um go to okay there is a there is a command called go to so it will go to the beginning so what I will say go to not here after the pause we will write okay so what what is it this one go to I am writing go to where you should go to the beginning right um so you can write any word let's go to a go to B something like that you can write or simply put a proper word let's say go to start I will say and this start here I have to Define with the colon whatever you are writing start a b c instead of start you can say a b c so the name should match that's all okay so what will happen this will after finishing this this will again go to the top so when it goes to the top it should clear the screen right it should clear the screen and then continue okay so this is let's see if this one is working or not okay let's save if something wrong we will still design it so we have to go in an iterative way small small things we should do and keep on testing rigorous testing we have to do all right so I have saved it let's run it okay so it is asking enter the name so you can see it is asking in a proper way so Rakesh Rakesh we are delighted to have you at the event okay Enter let's say the next person is coming John so hit on enter we are delighted to have you at the event very good okay so let's say somebody is called treaty Preeti is coming okay Priti we are delighted to have you at the event okay the small programming so we have achieved what is needed still there are lot many advancement we can do but we'll go step by step okay we don't want to learn everything on the day one slowly we'll go we'll enjoy and learn so thank you guys for watching so you got the course right how we have written pretty simple ones but interesting one so let's move on to our next topic and learn something new thank you
Info
Channel: Automate with Rakesh
Views: 9,572
Rating: undefined out of 5
Keywords: batch file, batch scripting, batch file command, batch file tutorial, batch script automate user input, batch script get user input, batch script user input variable, batch file automate user input, batch file get user input
Id: vowlGmA1u8U
Channel Id: undefined
Length: 6min 25sec (385 seconds)
Published: Sun Nov 20 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.