• "set" command in cmd help
    2 replies, posted
hey i have a question about the set command in cmd. [code] SYNTAX: (the /p is not necessary) set /p input= input here > echo %input% result: input here > hello hello [/code] when i enter nothing in the input and just press enter the program crashes. how do i make it go back to the beginning of the script by using the goto command... or make it just recognize that there is no input... so it looks like this in the program. [code] input here > input here > input here > etc. [/code]
Look up if else commands and check if the input is empty or not.
Wrap input here > in quotations, like so: [code]@echo off cls :start set /p input="input here >" echo %input% goto start[/code] I also included the way to properly go to a segment of code. There needs to be a specific line as :ref_name_here which is only one word. Then you run a goto command and point to that reference name.
Sorry, you need to Log In to post a reply to this thread.