Saved Bookmarks
| 1. |
Solve : Echoing $V (prompt)? |
|
Answer» Quote from: billrich on June 03, 2009, 08:30:14 PM
I copied/pasted the above coding into Trial.bat and this is the output with Echo Off: Quote C:\>trial With Echo set to On the following is produced: Quote ←C:\>trial Nowhere can I find that you set any variable to the current OS version, the variable %varp% is set to the Prompt switch (aka text) $v as is shown in your Echo COMMAND. What the OP asked for is that a variable be set to the output of Prompt $v which is the OS version details. You will appreciate that, when Prompt $V is used, Prompt in this case is an Internal Command which will be interpreted by CMD.exe and the variable %Prompt% will be set to the prompt switch so that %Prompt% is set to $V not to the result of Prompt $V.Hedi wrote: Quote You will appreciate that, when Prompt $V is used, Prompt in this case is an Internal Command which will be interpreted by CMD.exe and the variable %Prompt% will be set to the prompt switch so that %Prompt% is set to $V not to the result of Prompt $V. You might be right. How do we ASSIGN the output of "prompt $v" to a variable that we then can echo? C:\>prompt echo $v$G echo Microsoft Windows XP [Version 5.1.2600]> echo Microsoft Windows XP [Version 5.1.2600]>prompt C:\>@Hedonist this advice may be a bit late, but your struggle is as futile as trying to teach Nymph4 something. I'm sure you can relate to that. BC_P - don't remind me Billrich has raised a good question, how does ONE redirect Prompt output? Until 5 mins ago it's a THING I've never tried, never even thought of. So far I've not been able to redirect it anywhere so perhaps Prompt does not write to Stdout, or redirection is suppressed. I'm guessing it's the latter, if redirection was permitted then the command prompt would be null, not even CR\LF (Prompt $_) which could cause mayhem. I cannot think of any reason to want to redirect Prompt output. I'll have to give more thought to that.. Quote from: BatchFileBasics on June 03, 2009, 08:22:35 PM yea, he was probably stressedActually I was quite SICK and had a throbbing headache...thought something like that |
|