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

Page 1 of 4 123 ... LastLast

  1. Posts : 37
    Windows 7 Ultimate 32 bit
       #1

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


    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


  2. Posts : 325
    windows 7 Pro 64 Bit
       #2

    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


  3. Posts : 37
    Windows 7 Ultimate 32 bit
    Thread Starter
       #3

    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 by alacarre; 06 Aug 2014 at 18:32. Reason: explained in text
      My Computer


  4. Posts : 325
    windows 7 Pro 64 Bit
       #4

    Maybe setting the taskbar properties to "Never Combine"?
      My Computer


  5. Posts : 37
    Windows 7 Ultimate 32 bit
    Thread Starter
       #5

    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


  6. Posts : 325
    windows 7 Pro 64 Bit
       #6

    Seems to work here:

    How to create a duplicate cmd.exe under Win7 SP1?-cmd-tasks.jpg
      My Computer


  7. Posts : 325
    windows 7 Pro 64 Bit
       #7

    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


  8. Posts : 325
    windows 7 Pro 64 Bit
       #8

    How to create a duplicate cmd.exe under Win7 SP1?-taskbar.jpg
      My Computer


  9. Posts : 37
    Windows 7 Ultimate 32 bit
    Thread Starter
       #9

    msalton1 said:
    Seems to work here:

    How to create a duplicate cmd.exe under Win7 SP1?-cmd-tasks.jpg
    What am I looking at?
      My Computer


  10. Posts : 325
    windows 7 Pro 64 Bit
       #10

    alacarre said:
    msalton1 said:
    Seems to work here:

    How to create a duplicate cmd.exe under Win7 SP1?-cmd-tasks.jpg
    What am I looking at?
    That's the taskbar shortcuts on the bottom...an explorer window containing the shortcuts on top. My subsequent image should clear it up.
      My Computer


 
Page 1 of 4 123 ... LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:00.
Find Us