Jump to content

Ms-dos Question


Sacred
 Share

Recommended Posts

Does anybody know how to use user-input to set a variable in MS-DOS? To make VAR1 = 12 for example, or a string of letters. I used to know how, but I forgot. Can anyone help me out here?I know in C++ it is cin >> VAR1;In MS-DOS it's like set /p VAR1 =Or something like that, but it doesn't seem to work.I wanna use that data to compare using an IF statement, that part isn't hard, just the user-input part is what I need to know.All Help is greatly appreciated ~Sacred

Link to comment
Share on other sites

It's like you wrote, but with a space before the equals sign. Note that this doesn't actually take the value from the standard input - piping won't work.Edit: Ah, did I actually write that? I meant without a space.

Link to comment
Share on other sites

All I know is, is that I used to be able to ask for passwords in batch files so that if a variable equaled that value I preset, it would GOTO wherever I chose it to go. I know there is a way, I did it before. It's like:---------------------------------------------------------------------set /p Password = [should Be User-Input Here]IF(%password%)=="1337" GOTO PASSWORDACCEPTED---------------------------------------------------------------------

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...