0

I have a batch script in my Startup folder which begins with chcp 65001. This will crash CMD after the first command after chcp but it won't crash ConEmu.

So how do I make it run in ConEmu instead of CMD after logon?

Ilyes
  • 14,640
  • 4
  • 29
  • 55
Weylyn Savan
  • 113
  • 4
  • I haven't come across a batch script that crashes CMD itself in codepage 65001. Possibly some other program dies such as more.com? Anyway, CMD is not the console (conhost.exe), so I assume you mean that CMD doesn't crash when run in ConEmu. – Eryk Sun Sep 15 '17 at 06:30
  • There's no more.com in my script. It is a simple script that will map network folders after i log in and not while i log in. This seems pointless but my home server is not very fast and it could take up to two minutes to map all five network folders. After i logged in, i don't care how much time does it take but it's annoying to wait up to two minutes to log in. Basically the script only contains five `net use`. – Weylyn Savan Sep 15 '17 at 16:01
  • So it's probably net.exe that dies. Did you use `chcp 65001` because the script is saved as UTF-8, maybe to access UNC paths that can't be encoded in the OEM codepage? If so, how about the ANSI codepage or another codepage? – Eryk Sun Sep 15 '17 at 17:03
  • The problem with other codepages is the letter `'é'` in one of the shares. I was looking for the correct codepage for this character for a long time and a few days earlier, i accidentally found 65001 while searching for something else. I don't know what else codepage could i use. But i don't think the encoding would be the problem because it doesn't crash if it runs in ConEmu. – Weylyn Savan Sep 15 '17 at 20:38
  • And you've saved the script as UTF-8 without a byte order mark (BOM)? – Eryk Sun Sep 15 '17 at 20:40
  • `'é'` is defined in codepages 437 and 850 -- the console's default codepages in the U.S. and Europe, respectively. What's your system locale? – Eryk Sun Sep 15 '17 at 20:44

1 Answers1

0

Did you read docs?

ConEmu64.exe -run "path-to-your-batch.cmd"
Maximus
  • 10,751
  • 8
  • 47
  • 65
  • So the only way is to write a script that will open ConEmu which will run the script i want? By the way, i already knew how to run scripts manually in ConEmu. That wasn't the question. – Weylyn Savan Sep 15 '17 at 05:11
  • You already have script. So you just have to change shortcut to your existing script, shortcut placed in your startup folder. – Maximus Sep 15 '17 at 15:39
  • What shortcut? The script itself is placed in the startup folder. Windows likes to play with drive letters and I'm just too lazy to always fix it. – Weylyn Savan Sep 15 '17 at 15:58
  • Scripts are usually stored in git/Dropbox/onedrive or something to maintain them and transfer between machines. So you create a shortcut to your script and place the shortcut in the Startup folder. If you don't like this handy method, you may use [Default terminal](https://conemu.github.io/en/DefaultTerminal.html) feature. – Maximus Sep 16 '17 at 09:55