Tuesday, November 14, 2017

windows 7 - Ansicon vs. Batch File



I am attempting to make a colored command prompt in Windows 7.




Using ansicon, I have successfully managed to create the prompt. However, when I put the commands into a batch file, I receive an error.



These are the commands that I am using:



ansicon -p
chcp 65001
prompt $e[1;31m█$e[1;32m█$e[1;34m█$e[1;33m$_$d $t$_$e[1;37m$p$g


Below is an image that shows the contents and execution of the batch file, and the error that occurs when executing the prompt command within the batch file. It also shows the manual execution of the commands, and the resulting command prompt.




Ansicon batch failure



How can I get the commands to properly execute from a batch file?


Answer



I was unable to get the batch file to work correctly, so I ended up taking @EBGreen's suggestion and using PowerShell. I did have to run the command Set-ExecutionPolicy RemoteSigned in PowerShell to get my profile to run, however.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...