0

I'm currently working on a new project. Since I use ANSI in this java project I realised I can't use these colors in a windows cmd.

I already tried various ways but none of them helped.

So, what do I want to do? I want to run my jar file through a bat file in a new cmd but not the cmd from windows. I want to use the ansicon cmd (ANSICON GitHub).

So, I already tried this:

START ansicon.exe /k java -jar myjarfile.jar

But this doesn't worked at all.

I hope you can help me, many thanks in advance!

  • Please take the [tour], read [Ask], and [MCVE]. What exactly does "this doesn't work at all" actually mean? What results did you expect and what did witness? – jwdonahue Aug 23 '18 at 00:05
  • I'm sorry, I wasn't clear enough. I mean, when I start the bat file nothing happens. It doesn't even open ansicon. I expected that ansicon opens and run the jar file. – Lukas Keller Aug 23 '18 at 00:06
  • What happens when you run `start ansicon.exe /k?` What do you expect to happen? Does running `java -jar myjarfile.jar` work? – jwdonahue Aug 23 '18 at 00:08
  • When I start ansicon and enter there `java -jar myjarfile.jar` it's working fine. But I want to open it through a bat file, so I want to open ansicon and send the `java -jar myjarfile.jar` command but this doesn't work because nothing happened. When I use `start ansicon.exe /k?` nothing happens too. – Lukas Keller Aug 23 '18 at 00:12
  • I'm so sorry that I wasted your time. I found a solution. The following bat file is working fine: `START ansicon.exe java -jar myjarfile.jar` – Lukas Keller Aug 23 '18 at 00:18
  • Sounds like you have a problem with ansicon.exe. Just run ansicon.exe from a cmd prompt, what happens then? – jwdonahue Aug 23 '18 at 00:21
  • What version of Windows are you running? Win10 console already support ansi escape sequences. – jwdonahue Aug 23 '18 at 00:23
  • Typically using the start, you need to give a windows title, or no title.. i.e `start "" commandname parameters` – Gerhard Aug 23 '18 at 06:42
  • So it was the `/k` parameter that was the cause of the problem? – jwdonahue Aug 23 '18 at 06:54
  • Yes, the `/k` parameter was the cause of the problem. It's working perfectly now, without the `/k`parameter. Thank you all. – Lukas Keller Aug 23 '18 at 10:34

0 Answers0