How to create a duplicate cmd.exe under Win7 SP1?

alacarre

New member
Local time
3:02 AM
Messages
37
Location
Cambodia
I know, you're shaking your head and about to type in:


  1. copy %windir%\system32\cmd.exe C:\MyUtilities\cmd.exe (or failing that)
  2. copy %windir%\system32\cmd.exe C:\MyUtilities\MyCmd.exe

And, getting ready with the follow up "You can always just run it twice. That's allowed".

Well, there are two problems with those answers. The first answer has the unfortunate property of being wrong. Well, not "wrong", exactly; the program won't function correctly unless it is called cmd.exe and in the system32 directory and there must exist another copy in a specially named folder, and a special "encrypted copy" with an ".mui" extension also having a duplicate in a specially named folder.

In fact, cmd.exe only works properly (as far as I can tell) as long as you have the following collection of pairs of identical binaries:

Collection 1:
C:\Windows\System32\cmd.exe
C:\Windows\winsxs\x86_microsoft-windows-commandprompt_31bf3856ad364e35_6.1.7601.17514_none_8d1430a8789ea27a\cmd.exe

Collection 2:
C:\Windows\System32\en-US\cmd.exe.mui
C:\Windows\winsxs\x86_microsoft-windows-c..andprompt.resources_31bf3856ad364e35_6.1.7601.17514_en-us_81894823f02c4c17\cmd.exe.mui

Added to that, just as a triple check here's what "fc" says:

C:\Windows>fc C:\Windows\System32\cmd.exe C:\Windows\winsxs\x86_microsoft-windows-commandprompt_31bf3856ad364e35_6.1.7601.17514_none_8d1430a8789ea27a\cmd.exe

Comparing files C:\WINDOWS\SYSTEM32\cmd.exe and C:\WINDOWS\WINSXS\X86_MICROSOFT-WINDOWS-COMMANDPROMPT_31BF3856AD364E35_6.1.7601.17514_NONE_8D1430A8789EA27A\CMD.EXE
FC: no differences encountered

and, as you can probably guess:

C:\Windows>fc C:\Windows\System32\en-US\cmd.exe.mui C:\Windows\winsxs\x86_micros
oft-windows-c..andprompt.resources_31bf3856ad364e35_6.1.7601.17514_en-us_8189482
3f02c4c17\cmd.exe.mui

Comparing files C:\WINDOWS\SYSTEM32\EN-US\cmd.exe.mui and C:\WINDOWS\WINSXS\X86_MICROSOFT-WINDOWS-C..ANDPROMPT.RESOURCES_31BF3856AD364E35_6.1.7601.17514_EN-US_81894823F02C4C17\CMD.EXE.MUI
FC: no differences encountered

With the caveat that:

C:\Windows>fc C:\Windows\System32\cmd.exe C:\Windows\System32\en-US\cmd.exe.mui

Comparing files C:\WINDOWS\SYSTEM32\cmd.exe and C:\WINDOWS\SYSTEM32\EN-US\CMD.EXE.MUI
0000003C: E8 B8
00000080: DE 01
00000081: 4E 75
00000082: 92 F5
00000083: B9 D9
00000084: 9A 45
00000085: 2F 14
00000086: FC 9B
... etc

And if you try to run cmd.exe from any other directory it *can* work, but you get directory listings (or any listing) like this:

************************************************
C:\Windows>d:cmd
The system cannot find message text for message number 0x2350 in the message file for Application.

Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Windows>dir
The system cannot find message text for message number 0x235f in the message file for Application.
The system cannot find message text for message number 0x235b in the message file for Application.

The system cannot find message text for message number 0x2339 in the message file for Application.
08/06/2014 09:26 PM The system cannot find message text for message number 0x2373 in the message file for Application.
.
08/06/2014 09:26 PM The system cannot find message text for message number 0x2373 in the message file for Application.
..
07/14/2009 09:37 AM The system cannot find message text for message number 0x2373 in the message file for Application.
AppCompat
11/21/2010 07:38 AM The system cannot find message text for message number 0x2373 in the message file for Application.

ETC ....

07/14/2009 08:14 AM 31,232 twunk_32.exe
06/11/2009 04:14 AM 51,867 Ultimate.xml
07/14/2009 11:54 AM 403 win.ini
08/06/2014 08:43 PM 1,404,268 WindowsUpdate.log
06/11/2009 04:42 AM 256,192 winhelp.exe
07/14/2009 08:14 AM 9,728 winhlp32.exe
06/11/2009 04:34 AM 316,640 WMSysPr9.prx
07/14/2009 08:14 AM 9,216 write.exe
The system cannot find message text for message number 0x2378 in the message file for Application.
The system cannot find message text for message number 0x2379 in the message file for Application.

************************************************

And you can probably guess why.

Now, prior to being forced to install SP1 (because I accidentally messed up my registry and Windows "accidentally" deleted all my restore points so I had to do a re-install from scratch) I discovered a way around this which was simply to put your copy of cmd.exe under a new name (CommandProcessor.exe say) and create a .mui file in the en-US folder which was also an exact copy of cmd.exe (which it isn't possible with the new and improved version)

So I could have two "product instances" (for lack of a better word) of cmd.exe. And the reason that is desirable, if not necessary, is because one of them is running with administrator rights and the other with standard rights and I need to be able to distinguish between these two completely different beasts and not have them occupy the same position on the taskbar. In fact, I had disabled the update service only because I knew this change was coming.

The reason why it is of critical importance that the two instances do not appear together is because I know with 100% certainty that otherwise I will eventually make a mistake and run *explorer* from the wrong box say, when it crashes (or more likely when I kill it as I often do).

Following that, now unbeknownst to me, I would be running everything with administrator privileges for as long as that explorer's session lasts (ie. up to days).

Any ideas? I would like to duplicate this "gang of 4" and simply have a differently named program that has the same code in it as cmd.exe

Thanks in advance,
Alan
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome
Maybe I'm missing something, but couldn't you just create shortcuts to the command prompt, editing the properties to run as admin for those you wish?

To differentiate, just name the shortcuts as you wish, and the new name will show up on the title bar, along with "Administrator:cmd.exe and the name of the shortcut in both the title bar and the taskbar tooltip (non-admin will just show whatever you've named the shortcut).

Changing the icon via the shortcut properties causes the taskbar to display that icon.

IOW, it's all doable via the shortcut properties.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom
OS
windows 7 Pro 64 Bit
CPU
i5 4670K
Motherboard
Asus Max Hero 1150 socket
Memory
16GB DDR3@933mhz
Graphics Card(s)
Radeon R9 390 8192mb
Monitor(s) Displays
Dell U2415 x3
Screen Resolution
1920 (5760) x 1200 x3
Hard Drives
System: Kingston 128GB SSD

Installing to Samsung 860 EVO 500GB
WD Black 2 TB & 1 TB
PSU
Corsair CX750M
Cooling
Hyper 312
Internet Speed
50mbps
It displays the first icon it sees, but groups them together ever after. If it's the same program then they get put in the same slot (under win7). If you change the name of the binary, then and *only* then will they be separated.

[Edited to add]
I already have the two shortcuts, I've had them for ages. I select them as needed, but I don't usually close cmd because I'll be working there. Sometimes the work requires an admin action, sometimes not.

[One more edit]
Administrator: is not enough visible differentiation to prevent the accident I described. I barely ever read the title bars. Instead I use a different color background. But still, I don't want them together on the taskbar.
 
Last edited:

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome
Maybe setting the taskbar properties to "Never Combine"?
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom
OS
windows 7 Pro 64 Bit
CPU
i5 4670K
Motherboard
Asus Max Hero 1150 socket
Memory
16GB DDR3@933mhz
Graphics Card(s)
Radeon R9 390 8192mb
Monitor(s) Displays
Dell U2415 x3
Screen Resolution
1920 (5760) x 1200 x3
Hard Drives
System: Kingston 128GB SSD

Installing to Samsung 860 EVO 500GB
WD Black 2 TB & 1 TB
PSU
Corsair CX750M
Cooling
Hyper 312
Internet Speed
50mbps
Haha, well I tried that. It would seem to be the only solution. So I have to change the way everything works because of one thing that doesn't work. I may do it, but I think there must be a way to create a copy of a program and have it run.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome
Seems to work here:

Cmd Tasks.JPG
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom
OS
windows 7 Pro 64 Bit
CPU
i5 4670K
Motherboard
Asus Max Hero 1150 socket
Memory
16GB DDR3@933mhz
Graphics Card(s)
Radeon R9 390 8192mb
Monitor(s) Displays
Dell U2415 x3
Screen Resolution
1920 (5760) x 1200 x3
Hard Drives
System: Kingston 128GB SSD

Installing to Samsung 860 EVO 500GB
WD Black 2 TB & 1 TB
PSU
Corsair CX750M
Cooling
Hyper 312
Internet Speed
50mbps
I prefer the never combine setting. I also set the icons to 'small', the taskbar to autohide and resize it vertically to handle the pinned icons and two rows of running apps. It can be frustrating to arrange it all, but I find it works well.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom
OS
windows 7 Pro 64 Bit
CPU
i5 4670K
Motherboard
Asus Max Hero 1150 socket
Memory
16GB DDR3@933mhz
Graphics Card(s)
Radeon R9 390 8192mb
Monitor(s) Displays
Dell U2415 x3
Screen Resolution
1920 (5760) x 1200 x3
Hard Drives
System: Kingston 128GB SSD

Installing to Samsung 860 EVO 500GB
WD Black 2 TB & 1 TB
PSU
Corsair CX750M
Cooling
Hyper 312
Internet Speed
50mbps
Taskbar.JPG
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom
OS
windows 7 Pro 64 Bit
CPU
i5 4670K
Motherboard
Asus Max Hero 1150 socket
Memory
16GB DDR3@933mhz
Graphics Card(s)
Radeon R9 390 8192mb
Monitor(s) Displays
Dell U2415 x3
Screen Resolution
1920 (5760) x 1200 x3
Hard Drives
System: Kingston 128GB SSD

Installing to Samsung 860 EVO 500GB
WD Black 2 TB & 1 TB
PSU
Corsair CX750M
Cooling
Hyper 312
Internet Speed
50mbps

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom
OS
windows 7 Pro 64 Bit
CPU
i5 4670K
Motherboard
Asus Max Hero 1150 socket
Memory
16GB DDR3@933mhz
Graphics Card(s)
Radeon R9 390 8192mb
Monitor(s) Displays
Dell U2415 x3
Screen Resolution
1920 (5760) x 1200 x3
Hard Drives
System: Kingston 128GB SSD

Installing to Samsung 860 EVO 500GB
WD Black 2 TB & 1 TB
PSU
Corsair CX750M
Cooling
Hyper 312
Internet Speed
50mbps
I prefer the never combine setting. I also set the icons to 'small', the taskbar to autohide and resize it vertically to handle the pinned icons and two rows of running apps. It can be frustrating to arrange it all, but I find it works well.

Oh, me 2. Small and combine. I also have several utilities to send things to the system tray. I'm very hard at work trying to organize that taskbar but it fights you at every corner.

One thing, I forgot to mention, you can't have 2 different links to the same program in the quicklaunch area (which is where they must go, because the lining up becomes "same program @ same position always"
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome
I'm not sure I understand the problem. You can copy cmd.exe to any folder. The copy will open to a cmd window with the path of where it's currently located. You can create a shortcut and place it anywhere, edit the properties to make it admin if you wish, also edit to change the icon. You shouldn't have any problems placing multiple shortcuts in the same quicklaunch (if you do, create your own QL toolbar).

Again, maybe I'm missing something...
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom
OS
windows 7 Pro 64 Bit
CPU
i5 4670K
Motherboard
Asus Max Hero 1150 socket
Memory
16GB DDR3@933mhz
Graphics Card(s)
Radeon R9 390 8192mb
Monitor(s) Displays
Dell U2415 x3
Screen Resolution
1920 (5760) x 1200 x3
Hard Drives
System: Kingston 128GB SSD

Installing to Samsung 860 EVO 500GB
WD Black 2 TB & 1 TB
PSU
Corsair CX750M
Cooling
Hyper 312
Internet Speed
50mbps
You're probably missing Service Pack 1. You're talking old days, like last year.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome
You're probably missing Service Pack 1. You're talking old days, like last year.

I'm running SP1, 64 bit. Have been since beta.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom
OS
windows 7 Pro 64 Bit
CPU
i5 4670K
Motherboard
Asus Max Hero 1150 socket
Memory
16GB DDR3@933mhz
Graphics Card(s)
Radeon R9 390 8192mb
Monitor(s) Displays
Dell U2415 x3
Screen Resolution
1920 (5760) x 1200 x3
Hard Drives
System: Kingston 128GB SSD

Installing to Samsung 860 EVO 500GB
WD Black 2 TB & 1 TB
PSU
Corsair CX750M
Cooling
Hyper 312
Internet Speed
50mbps
Well, actually though you have a point. I could create something like a hard link say, so the paths are different. Otherwise the command line is the same and it should (checking...) ya, if it's the same program when you right click it you get a "Remove From Taskbar" option (not add).
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome
You're probably missing Service Pack 1. You're talking old days, like last year.

I'm running SP1, 64 bit. Have been since beta.

So you've added 2 links to the same program? Because I don't get that option. Although mine takes some parameters (startup batch file and a switch). When I change the parameters it still says "Remove"
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome
Well, actually though you have a point. I could create something like a hard link say, so the paths are different. Otherwise the command line is the same and it should (checking...) ya, if it's the same program when you right click it you get a "Remove From Taskbar" option (not add).

I haven't tried to place them in the QL bar, but as you can see in my 1st image, I have two shortcuts in one folder. I don;t see any reason why that can't be done with QL.

Remember, the two shortcuts were pointing to two different copies of cmd.exe in different locations (they will open to the path of their location).

Between being able to have multiple copies and the ability to edit the shortcut properties, there is much flexibility.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom
OS
windows 7 Pro 64 Bit
CPU
i5 4670K
Motherboard
Asus Max Hero 1150 socket
Memory
16GB DDR3@933mhz
Graphics Card(s)
Radeon R9 390 8192mb
Monitor(s) Displays
Dell U2415 x3
Screen Resolution
1920 (5760) x 1200 x3
Hard Drives
System: Kingston 128GB SSD

Installing to Samsung 860 EVO 500GB
WD Black 2 TB & 1 TB
PSU
Corsair CX750M
Cooling
Hyper 312
Internet Speed
50mbps
They may open, but they won't work. Not after SP1 (although mine is x86).

[Edited to add]
You did see that output right? I typed "dir"
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome
Another thing, the way things are these days with COM say, an experiment performed on one machine says very little about what will happen on another. If cmd.exe were just a regular old Win32 executable then it should work the same. No matter what I do with it. But it's not. It must be using COM for its text output or something, or has some special manifest embedded in it which makes no difference if you're living in the US but may break in Cambodia where I am.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Acer
OS
Windows 7 Ultimate 32 bit
CPU
Pentium P6200 dual core@1GHz
Motherboard
Acer Aspire 5742Z
Memory
2 Gig
Graphics Card(s)
Intel
Hard Drives
1
Antivirus
MS Security Essentials
Browser
Chrome
Back
Top