From: Leo on
I need a way to get the value of the %prompt% environment variable. I
would prefer it actually if I could get the value from a more reliable
source as this is a console app I'm writing.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


From: Leo on
Leo formulated on Wednesday :
> I need a way to get the value of the %prompt% environment variable. I would
> prefer it actually if I could get the value from a more reliable source as
> this is a console app I'm writing.

Scrap the more reliable way section as it is one of the few environment
variables that I don't mind changing. I forgot to mention I have tried
Environ and GetEnvironmentVariable. I think it has to do with the fact
the prompt environment variable is hidden according to
http://ss64.com/nt/prompt.html.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


From: dpb on
Leo wrote:
> Leo formulated on Wednesday :
>> I need a way to get the value of the %prompt% environment variable. I
>> would prefer it actually if I could get the value from a more reliable
>> source as this is a console app I'm writing.
>
> Scrap the more reliable way section as it is one of the few environment
> variables that I don't mind changing. I forgot to mention I have tried
> Environ and GetEnvironmentVariable. I think it has to do with the fact
> the prompt environment variable is hidden according to
> http://ss64.com/nt/prompt.html.
>

Don't know if there's anywhere like in registry the current value is
stashed reliably or not; if GETENV doesn't work (I've never tried it for
the prompt string) about the best I can think of would be to issue a

SET PROMPT

command and redirect the output and parse that. That, of course, has
the problem of whether that gets executed in the current shell or a
spawned one and whether they're the same or not. Not to mention, of
course, the issues of what happens if the user is running an extended
shell such as one of the JP Software products <www.jpsoft.com> with a
great number of additional features including being able to string
variable functions into the string, etc., ...


4NT 3.02B Windows NT 5.01
Copyright 1988-1999 Rex Conn & JP Software Inc. All Rights Reserved
4NT S/N CDXXXXXX, registered to ------------
for use on a single computer. May not be distributed to others.

c:\> set prompt
%@if[%@len[%_cwd] le 35,%_cwd,%@left[16,%_cwd]...%@right[16,%_cwd]]$g

c:\>

Good luck... :)

--
From: Jeff Johnson on
"dpb" <none(a)non.net> wrote in message
news:i1ke21$mbo$1(a)news.eternal-september.org...
> Leo wrote:
>> Leo formulated on Wednesday :
>>> I need a way to get the value of the %prompt% environment variable. I
>>> would prefer it actually if I could get the value from a more reliable
>>> source as this is a console app I'm writing.
>>
>> Scrap the more reliable way section as it is one of the few environment
>> variables that I don't mind changing. I forgot to mention I have tried
>> Environ and GetEnvironmentVariable. I think it has to do with the fact
>> the prompt environment variable is hidden according to
>> http://ss64.com/nt/prompt.html.
>>
>
> Don't know if there's anywhere like in registry the current value is
> stashed reliably or not; if GETENV doesn't work (I've never tried it for
> the prompt string) about the best I can think of would be to issue a
>
> SET PROMPT
>
> command and redirect the output and parse that. That, of course, has the
> problem of whether that gets executed in the current shell or a spawned
> one and whether they're the same or not. Not to mention, of course, the
> issues of what happens if the user is running an extended shell such as
> one of the JP Software products <www.jpsoft.com> with a great number of
> additional features including being able to string variable functions into
> the string, etc., ...
>
>
> 4NT 3.02B Windows NT 5.01
> Copyright 1988-1999 Rex Conn & JP Software Inc. All Rights Reserved
> 4NT S/N CDXXXXXX, registered to ------------
> for use on a single computer. May not be distributed to others.
>
> c:\> set prompt
> %@if[%@len[%_cwd] le 35,%_cwd,%@left[16,%_cwd]...%@right[16,%_cwd]]$g
>
> c:\>
>
> Good luck... :)

ECHO %PROMPT% worked for me as well, and you don't have to parse out the
PROMPT= stuff at the beginning....


From: Leo on
Jeff Johnson formulated on Thursday :
> "dpb" <none(a)non.net> wrote in message
> news:i1ke21$mbo$1(a)news.eternal-september.org...
>> Leo wrote:
>>> Leo formulated on Wednesday :
>>>> I need a way to get the value of the %prompt% environment variable. I
>>>> would prefer it actually if I could get the value from a more reliable
>>>> source as this is a console app I'm writing.
>>>
>>> Scrap the more reliable way section as it is one of the few environment
>>> variables that I don't mind changing. I forgot to mention I have tried
>>> Environ and GetEnvironmentVariable. I think it has to do with the fact the
>>> prompt environment variable is hidden according to
>>> http://ss64.com/nt/prompt.html.
>>>
>>
>> Don't know if there's anywhere like in registry the current value is
>> stashed reliably or not; if GETENV doesn't work (I've never tried it for
>> the prompt string) about the best I can think of would be to issue a
>>
>> SET PROMPT
>>
>> command and redirect the output and parse that. That, of course, has the
>> problem of whether that gets executed in the current shell or a spawned one
>> and whether they're the same or not. Not to mention, of course, the issues
>> of what happens if the user is running an extended shell such as one of the
>> JP Software products <www.jpsoft.com> with a great number of additional
>> features including being able to string variable functions into the string,
>> etc., ...
>>
>>
>> 4NT 3.02B Windows NT 5.01
>> Copyright 1988-1999 Rex Conn & JP Software Inc. All Rights Reserved
>> 4NT S/N CDXXXXXX, registered to ------------
>> for use on a single computer. May not be distributed to others.
>>
>> c:\> set prompt
>> %@if[%@len[%_cwd] le 35,%_cwd,%@left[16,%_cwd]...%@right[16,%_cwd]]$g
>>
>> c:\>
>>
>> Good luck... :)
>
> ECHO %PROMPT% worked for me as well, and you don't have to parse out the
> PROMPT= stuff at the beginning....

Environ("PROMPT") returns a blank string for me on Win7 64 Bit.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org