11

I'd like to change the encoding of the command prompt when being opened rather than typing the command at the start of my session each time.

Below is the command I enter each time the command prompt starts now:

chcp 1252

How can I have this command run automatically when opening with the shortcut?

Dane O'Connor
  • 1,168
  • 8
  • 17
  • 30
  • [Automatically executing commands when a command-prompt is opened](https://superuser.com/q/302194/241386) – phuclv Mar 17 '19 at 11:18

2 Answers2

18

In the target box of your shortcut, use

cmd /K "chcp 1252"

This should run your program and leave the cmd window up when complete

DaveParillo
  • 14,505
  • 1
  • 39
  • 46
9

Per the docs on cmd.exe,

The registry keys:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ 
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun REG_EXPAND_SZ

should do what you want.

Alex Essilfie
  • 1,385
  • 2
  • 12
  • 23
Jordan
  • 1,060
  • 8
  • 6
  • Nice, this works for every cmd.exe, not just a particular shortcut. – Blorgbeard Jul 04 '10 at 15:19
  • To be clear, that means: find or make a key named Command Processor as specified, then in the right hand pane find AutoRun. If AutoRun is not there, right-click Command PRocessor and add an Expandable String Value named AutoRun, with a value of whatever you want run every time (e.g. chcp 1252). – Charles Wood Mar 10 '23 at 22:29