0

I need to modify the way the CMD shows the path, whether it's in a batch file or not.

For example:

~/Users/MyName/Desktop

instead of:

C:\Users\MyName\Desktop

It would also be appreciated if somene could tell me how to use colours in CMD in the following way:

echo /color1Blah/color2Blah

Hudson Serge
  • 155
  • 1
  • 2
  • 9
  • 1
    The answer is simple: use something like MSYS or Cygwin. –  Jan 16 '14 at 07:49
  • My internet is so bad that I can't download all the packages for these things. I don't want to actually change the commands along with package managers and stuff, just the visuals. – Hudson Serge Jan 16 '14 at 07:56
  • How would you display drives other than C if writing like that? And how can the shell distinguish the slash of path and the slash in command parameters? – phuclv Jan 16 '14 at 09:23

2 Answers2

1

The first path is a Linux path the second is a windows path - never the two shall meet.

Toby Allen
  • 10,997
  • 11
  • 73
  • 124
1

This takes me back to the days when everyone knew and used DOS!

There is a environment variable that controls how the prompt is displayed in the command window.

PROMPT=$P$G

You can kind of accomplish what you want, but with limitations. For instance, if you go to a command window and type:

C:\>prompt ~$P[space] (don't type the C:\> and [space] is an actual space), your prompt will change to:

~c:\[space]

You can type prompt /? to see all of the available options. Once you have found a combination that you like, edit the environment variable and it will be set for all future command windows. The biggest limitation is that you cannot change the backslashes to forward slashes.

As for colors, type color /? from the command line. You can set the entire background and foreground colors, but not individual elements on the screen. That is unless you can get a copy Ansi.sys and get Windows to load it when you open a Command Window. Here are a couple of cool links to sites that use color in the PROMPT.

I Googled ansi.sys windows 7 and found a few people that said they got it working (like here). I don't have Ansi.sys anywhere to give it a try.

James L.
  • 9,384
  • 5
  • 38
  • 77
  • There isn't any way to modify the variables? – Hudson Serge Jan 16 '14 at 08:07
  • For example, I know there's a variable to delete the previous character ($H I believe), so there has to be a way to make a variable that deletes the next character. In the following example ($F deletes the next character) `prompt $F$F$F~/$P[space]` – Hudson Serge Jan 16 '14 at 08:14
  • To modify the `PROMPT` variable, open Windows Explorer, press alt+D to move to the address line, paste `Control Panel\All Control Panel Items\System` and press Enter, click on Advanced System Settings, click on Environment Variables, edit (or add) a system variable called PROMPT with the prompt string you want. New Command Windows will use the new prompt. – James L. Jan 16 '14 at 08:26
  • 3rd party utilities can make the color stuff work (http://stackoverflow.com/questions/2294281/how-to-recognize-ansi-color-escape-codes-in-windows7-64-bit-command-terminal) – James L. Jan 16 '14 at 08:48