1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to get current 'prompt' string?

Discussion in 'CMD' started by Mel Davis, Mar 27, 2016.

  1. Mel Davis

    Joined:
    Apr 7, 2010
    Messages:
    19
    Likes Received:
    0
    My batch script needs to prepend a string to the current prompt string ... to identify the current virtual environment, similar to activating a python virtual environment.

    CMD.EXE sets the PROMPT environment variable; TCC does not.

    Is there a way to get the current prompt string?
     
  2. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,015
    Likes Received:
    0
    I believe if there is no Env. variable PROMPT then it defaults to $P$G else you can just ECHO %PROMPT%
     
  3. Mel Davis

    Joined:
    Apr 7, 2010
    Messages:
    19
    Likes Received:
    0
    Thank you. Just the info I needed.
     
  4. Howard Goldstein

    Joined:
    Jun 1, 2008
    Messages:
    111
    Likes Received:
    1
    Actually, if there is no Prompt environment variable the default string is [$p$g]
    The brackets are part of the string and the p must be lowercase. An uppercase P would display the entire path in uppercase.

    -- Howard
     

Share This Page