November 4th, 2003
any DOS batch file gurus out there?
I need to write a frontend for Net Send for my boss.
basically I just need it to go like this:
Text to send: *boss types text in, hits return*
net send [all our usernames] "[inputed text]"
Press any key to continue...
so how do I get it to input text into a variable and then use that variable in another statement? it's driving me nuts. it's the only part I'm stuck on.
A few years ago I would have whipped this out without blinking, but i'm just getting back to doing old skool batch files again.
Thanks for any help.
Fred forgot his DOSREXX, Fred forgot his DOSREXX...
I think the all caps kinda ruin the lyricism of it.
|Date:||November 4th, 2003 08:19 pm (UTC)|| |
COMMAND.COM IS SO FUCKING AWFUL
// Try this, without "// " of course:
// REM == comment in DOS
// REM first we initialize the var to
// REM since all DOS programs share a namespace
// set var=
// REM then we set variable from input using prompt
// REM the "%=%" is not part of the prompt
// set /P var=This is the greatest prompt ever: %=%
// REM now we have the variable initialized, and
// REM can do what we want.
// echo This is the variable: %var%
// I had to write a DOS script recently.
// btw.. I recommend naming it *.COM instead of *.BAT--
// that way it will use the new interpreter.
// HTH -- d_m
|Date:||November 4th, 2003 08:26 pm (UTC)|| |
BILLY GATES STOP MAKING MONEY AND STEP IN FRONT OF A TRAIN
// ALSO FOR THE RECORD:
// In WinXP, as far as I can tell, doing any sort of "set"
// in a block statment (i.e. inside an "if") doesn't
// resolve until you get back to the base level, or at least
// leave the block.
// The workaround is ugly like a gut wound.
// So, make sure to not use that in an "if" statement.