

Another is that when the user sees the goodbye message, they know they did something right, then if it crashes they'd know they did something wrong, because they didn't receive the goodbye message. For one thing, (keep in mind that depending on if you're using older or new batch this might be different) in the older versions of batch, using "" would make it so that you literally use the text "%Expr%" (quotations included), instead of the value for %Expr%, and it would check it against the text "q" (again, quotations included), rather than just q. There are many things about this that make it cleaner that what you have here. SET /P Expr=Enter expression here, or ' q' to quit: Thanks for any help you're able to provide. When I try to remove them with a for loop and delims it breaks.

but I can ' t figure out how to get rid of the quotes around each part of the URL as well as the underscores between each part (i.e. With my current " program" I can get the first half of the URL, the ID numbers, and the second half printed out as a list of complete URLs. I ' ve used your book (Batchography) for several batch file projects at work but the one I'm currently struggling with I ' m not sure your book addresses (and/or I'm not skilled enough yet to put it all together).Īll I would like to do is read a column of ID numbers from a text file (H:\B3.txt) and insert those ID numbers into the middle of a generic URL (http: // firsthalfofmyurl= &secondhalfofmyurl). To achieve this, we will use the "FOR /F" syntax.įrom the command prompt, to query the registry and retrieve the language ID, we can use the "reg.exe" command like such: It is possible to execute a command then break its output into tokens. We close the multi-line comment (with "*/") shortly after exiting the Batch file. The first line ("/*" a C multi-line comment opening) is not a valid command and it will cause an error but we redirect the error to the nul device. There's a slight drawback in this polyglot script. " Hello world! I was self-compiled!\n" " \n" " Checkout the Batchography book!\n") :: (c) Batchography book - by Elias BachaalanyĬl %~dpf0 /TP /EHsc /link /out:%outfile% /nologo > nul
