| 1. |
Solve : Choice Command?? |
|
Answer» Ok, i am using windows xp professional on a server, and i have been working with batch files and so forth, however, the choice command has brought a huge frustration to me, because everywhere i look it shows to be a valid command, yet when i type it into dos windows it shows no syntax, and no clue to me that it even exits and i'm wondering am i overlooking something really stupid or was the command just taken out of windows in this version. Also, another question would be if choice command does not work, then would there be another command to do the same effect? choice dosent work on xp but this code will do it set input=nothing when looking at it, i see "set /p" explanation of what the /p means PLEASE? i looked at the syntax and it showed me nothing, so i'm not completely sure on this. and then i'm assuming all of the variables that you enter in afterwards are surrounded by the % sign? Also, just out of speculation, i'm GUESSING the goto menu at the very end of this part of it is the else if part? as in, if they do not enter 1 or 2, then you go to menu? Thanks... Nothing is not a keyword in batch. The SET as written will SET the INPUT variable to the literal word "nothing". You're right about the "goto menu", it's not really the else so much as the fall thru option should none of the IFs prove true; yeah, you can consider it the else. You're also right about referencing variables once they have been assigned a value in that they must be surrounded by %. The /p option on the SET is to display a literal as a prompt and wait for input and an enter key. The CHOICE command offered 1 byte choices. Set offers unlimited length replies to the prompt. Keep this in mind when coding possible responses. Hope this helps. so you use the nothing to basically distinguish that it is a variable, and the nothing is just a RANDOM value to give it.... I do have another question, this is the current batch that i have MADE.... Quote @echo off Of course, i'm sure you noticed :2 and :3 have no assigned value, but thats to come later,r ight now i'm working on a problem i'm facing with the 1st one. When this performs, it freezes the batch file because of windows media player, Is there a way to bring it up so that the batch file will continue after the media player is open.... I do know that what you have to do currently is close the media player and it finished it (hence opening up windows stuff in DOS does this) but i'm not sure of any way to do this. I thought about using the taskkill, but when i thought about this, it made no sense since it won't go to any command line after the media player is open.... The only other way i can think to do this would be to use the call command, and create a batch file for each individual program that i want to open, and that would be really time consuming and annoying.... let alone, i'm not even sure if that will work or not.... i'm guessing i've hit a stop in this?? lolNot a stop. Your batch file is fine except on a few points. When you launch option 1 (WMPLAYER) you might want to consider using START otherwise your batch file will wait for WMPLAYER to end and return control back to your batch file. You might also want to think about "end"...it's not a batch command. :-/ What are you expecting it to do? well i use end b/c if i dont after it does option one it goes to two without stoping Quote goto menu ya so without it it just continues on through the other optionsQuote Code: [Select] :1 Quote Code: [Select] :1 end is used in two different contexts. In the first one end is used as a program call. Unless the poster has an executable named "end", the statement will fail. In the second post, "end" is used as a label or it seems that way. Labels need a : preceeding them. Batch language does not have many syntax rules but it's best to follow the few it does have. There are also subtle differences between START, CALL, and outright program executes. How many people are involved in this thread? Rather confusing, especially since the original post about CHOICE does not exist on a XP machine, unless you steal a copy from Win9x. yeah, it was about choice command or something similar, then it went into further depth anyways, i did notice that i put end instead of exit, and thought i had corrected it before someone replied. THanks for the help, you're awesome... |
|