I want to specify a custom command prompt when I launch a console. E.g Windows cmd.exe.

I am using the /K command line parameter in the shortcut that launches the console:

%SystemRoot%\system32\cmd.exe /K myprompt.bat

myprompt.bat contains the following lines:

prompt $d $t$_$p$g

When I issue the prompt command manually in the console window, the prompt appears like this:

enter image description here

However, if I execute myprompt.bat (either manually, or using the /K command line parameter), I receive the following error:

enter image description here

What am I doing wrong?


Try opening the batch file in notepad, and try another "encoding" option when you save it.

  • +1 The batch file has been saved as Unicode instead of ANSI. – Karan Jul 10 '13 at 21:54
  • It is saved as Unicode. I also tried Unicode big endian, and UTF-8, but I get the same results. – Welton v3.60 Jul 12 '13 at 14:54
  • I've ran into a similar problem before. I believe I ended up using the command line "Edit" and copying the script in there and saving it with a different file name. – Don Nickel Jul 12 '13 at 15:10
  • @Weltonv3.51: As my previous comment suggests, did you save as ANSI and try? You don't even need to create a new file. Just use Save As in Notepad with the same name but ANSI encoding. – Karan Jul 12 '13 at 18:05
  • 1
    @DonNickel: If this is 64-bit Windows there's no Edit available anymore. – Karan Jul 12 '13 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.