In Windows 10, how do I open a command prompt at a folder with specified foreground and background colors?

In Windows 7 I used the registry to be able to open a command prompt window rooted at a folder using the method given by Honeycutt in Microsoft Windows XP Registry Guide on page 98.  The procedure is as follows:

  1. In HKCR\Directory\shell, create the subkey cmdhere
  2. In HKCR\Directory\shell\cmdhere, set the default value to CMD Prompt Here
  3. In HKCR\Directory\shell\cmdhere, create the subkey command
  4. In HKCR\Directory\shell\cmdhere\command, set the default value to C:\Windows\Sustem32\cmd.exe /k cd "%1"

This is repeated in HKCR\Drive. The result is a menu item "CMD Prompt Here" which appears when right clicking a folder. Clicking the menu item opens the command prompt window.

In Windows 10 this opens the window but with the error: "The system cannot find the path specified." and the window opens int the C:\Windows\System32 directory.

I would like to know how to correct this and to use the /t:fg parameter to set the foreground and background colors. (See https://technet.microsoft.com/en-us/library/bb490880.aspx. ) Using the run capability on the start menu, I have tried every permutation of cmd.exe /k cd "D:\"  /t:fg that I can think of (replacing f and g with the correct numbers, including the cd in the quotes, etc.) and always get the same result. Help would be greatly appreciated.
LVL 1
rkulpAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JesterTooCommented:
In Win 10 you can open a cmd prompt at a specific folder by highlighting that folder in file explorer and pressing "shift + right-click".  Not sure how you can control the colors, though.
0
JohnBusiness Consultant (Owner)Commented:
You can change the Command background colour

http://www.intowindows.com/how-to-change-command-prompt-background-color-in-windows-10/

Then save the properties and it should come back in the same colour
0
JesterTooCommented:
John,
I believe that only changes the colors for the shortcut instance... I already tried that but it doesn't seem to "stick" when using the shift+rightclick method in file explorer.  Apparently, it is launching a "clean" version of cmd.exe.
0
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

JohnBusiness Consultant (Owner)Commented:
You might be correct. I use cmd.exe from the start menu, not context or keystrokes.
0
Shaun VermaakTechnical Specialist IVCommented:
Something I wrote 9 years ago, you can adapt it for one set of colours

Add this to registry
HKCU\Software\Microsoft\Command Processor
AutoRun 
RndColor.bat

Open in new window


Save as RndColor.bat into C:\Windows\System32
@Echo Off

SET rnd=%random%

REM ECHO %rnd:~5,1%
REM ECHO %rnd:~4,1%
REM ECHO %rnd:~3,1%
REM ECHO %rnd:~2,1%
REM ECHO %rnd:~1,1%
REM ECHO %rnd:~0,1%

IF NOT '%rnd:~5,1%'=='' SET rnd1=%rnd:~5,1%& SET rnd2=%rnd:~4,1%& GOTO BUILD
IF NOT '%rnd:~4,1%'=='' SET rnd1=%rnd:~4,1%& SET rnd2=%rnd:~3,1%& GOTO BUILD
IF NOT '%rnd:~3,1%'=='' SET rnd1=%rnd:~3,1%& SET rnd2=%rnd:~2,1%& GOTO BUILD
IF NOT '%rnd:~2,1%'=='' SET rnd1=%rnd:~2,1%& SET rnd2=%rnd:~1,1%& GOTO BUILD
IF NOT '%rnd:~1,1%'=='' SET rnd1=%rnd:~1,1%& SET rnd2=%rnd:~0,1%& GOTO BUILD
IF NOT '%rnd:~0,1%'=='' SET rnd1=%rnd:~0,1%& SET rnd2=0& GOTO BUILD

:BUILD
REM ECHO %rnd%
REM  ECHO %rnd2%%rnd1%

GOTO %rnd2%%rnd1%


Goto END

:00
Color 0A
Goto END

:01
Color 0B
Goto END

:02
Color 0C
Goto END

:03
Color 0D
Goto END

:04
Color 0E
Goto END

:05
Color 1A
Goto END

:06
Color 1B
Goto END

:07
Color 1C
Goto END

:08
Color 1D
Goto END

:09
Color 1E
Goto END

:10
Color 1F
Goto END

:11
Color 27
Goto END

:12
Color 2B
Goto END

:13
Color 2E
Goto END

:14
Color 2F
Goto END

:15
Color 37
Goto END

:16
Color 3A
Goto END

:17
Color 3B
Goto END

:18
Color 3E
Goto END

:19
Color 3F
Goto END

:20
Color 47
Goto END

:21
Color 4A
Goto END

:22
Color 4B
Goto END

:23
Color 4D
Goto END

:24
Color 4E
Goto END

:25
Color 4F
Goto END

:26
Color 57
Goto END

:27
Color 5A
Goto END

:28
Color 5B
Goto END

:29
Color 5C
Goto END

:30
Color 5E
Goto END

:31
Color 60
Goto END

:32
Color 64
Goto END

:33
Color 67
Goto END

:34
Color 69
Goto END

:35
Color 6A
Goto END

:36
Color 6E
Goto END

:37
Color 6F
Goto END

:38
Color 70
Goto END

:39
Color 72
Goto END

:40
Color 74
Goto END

:41
Color 75
Goto END

:42
Color 79
Goto END

:43
Color 7C
Goto END

:44
Color 80
Goto END

:45
Color 84
Goto END

:46
Color 87
Goto END

:47
Color 8E
Goto END

:48
Color 8F
Goto END

:49
Color 97
Goto END

:50
Color 9A
Goto END

:51
Color 9B
Goto END

:52
Color 9E
Goto END

:53
Color 9F
Goto END

:54
Color A0
Goto END

:55
Color A1
Goto END

:56
Color A4
Goto END

:57
Color A9
Goto END

:58
Color AC
Goto END

:59
Color AD
Goto END

:60
Color B0
Goto END

:61
Color B1
Goto END

:62
Color B4
Goto END

:63
Color B5
Goto END

:64
Color B9
Goto END

:65
Color BC
Goto END

:66
Color BD
Goto END

:67
Color C0
Goto END

:68
Color C1
Goto END

:69
Color C5
Goto END

:70
Color C7
Goto END

:71
Color CB
Goto END

:72
Color CE
Goto END

:73
Color CF
Goto END

:74
Color D0
Goto END

:75
Color D1
Goto END

:76
Color D4
Goto END

:77
Color D9
Goto END

:78
Color DA
Goto END

:79
Color DB
Goto END

:80
Color DE
Goto END

:81
Color DF
Goto END

:82
Color E0
Goto END

:83
Color E1
Goto END

:84
Color E2
Goto END

:85
Color E3
Goto END

:86
Color E4
Goto END

:87
Color E5
Goto END

:88
Color E9
Goto END

:89
Color EC
Goto END

:90
Color ED
Goto END

:91
Color F0
Goto END

:92
Color F1
Goto END

:93
Color F2
Goto END

:94
Color F3
Goto END

:95
Color F4
Goto END

:96
Color F5
Goto END

:97
Color F9
Goto END

:98
Color FC
Goto END

:99
Color FD
Goto END

:END
REM cls

Open in new window

0
Shaun VermaakTechnical Specialist IVCommented:
Here is video of what it does
http://somup.com/cbevqsWV3
0
Shaun VermaakTechnical Specialist IVCommented:
So when batch starts check for folder and change colour appropriately
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
I don't know (yet) where the path error comes from, but to use a single colour you need to put the colour parameter before /k, because everything after /c and /k is considered a command to execute literally.
C:\Windows\Sustem32\cmd.exe /t:fg /k cd "%1"

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rkulpAuthor Commented:
Thanks a bunch for your quick replies. Using the run feature on the menu, the cmd.exe /k cd "D:\" does not open the window at D:\. I haven't figured out how to present the t:fg parameter. Everything I've tried fails to work. The shift + right click also fails to open the command window -- it just acts like a right click. I may have caused that with the modifications I did to the register, but it does the same thing on an unmodified computer.
The random colour thing is neat. I'll have to figure that out once I get the window to open at the right directory.
0
JesterTooCommented:
shift right click...

This worked as advertised for me.  Did you have a folder selected when you tried it? It won't work unless you've selected a folder first.

Also, you canselect a folder and click on file to get a submenu that includes "open command prompt" as a option.
0
rkulpAuthor Commented:
I did have a folder selected but not a file. The same behavior occurred on folders in the right hand pane and the left hand pane. I did get the color to work right based on the following link: http://sourcedaddy.com/windows-7/cmd-options.html. So, to get my desired white background with black text I use: cmd.exe /t:F0. I still have to work on getting to the right directory.
0
rkulpAuthor Commented:
I got it to work using the following command:  C:\Windows\system32\cmd.exe /t:F0  /k cd "%1"
I have no idea why it didn't work with C:\Windows\system32\cmd.exe   /k cd "%1"
0
rkulpAuthor Commented:
I appreciate everyone's efforts.
0
JesterTooCommented:
Is this still the command you used in the registry key?

Congratulations!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.