New command cm_SwitchX64Redirection did not all of the job

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Vlad0
Junior Member
Junior Member
Posts: 9
Joined: 2009-07-15, 16:20 UTC

New command cm_SwitchX64Redirection did not all of the job

Post by *Vlad0 »

It is OK, switching off WOW64 redirection System32-->SysWOW64.
Dos prompt as well launches 64bit version of cmd.exe from the "real"
System32 folder.

But if one tries to start, say, msconfig.exe from the TC command line
TC can not find msconfig.exe. The same phenomenon is observed
when one tries to start some .cmd or .bat file: it is started with
32bit version of cmd.exe, so can not launch the file msconfig.exe
from the line
%windir%\system32\msconfig.exe
in the .cmd file.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48104
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This is intentional. For some functions like launching files, the redirection is turned back on, because they would otherwise not work at all (because of dlls not found etc).
Author of Total Commander
https://www.ghisler.com
Vlad0
Junior Member
Junior Member
Posts: 9
Joined: 2009-07-15, 16:20 UTC

Post by *Vlad0 »

If You succeeded in switching off WOW64 redirection
for TC, I can not see the reason why TC is
obliged to switch on this redirection, except for other 32bit progs
(which will die in 64bit world of "real" system32),
for itself as well. After he loads all of his own 32bit dlls
into his own address space.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48104
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I had to add several exceptions because otherwise almost nothing worked with redirection switched off...
Author of Total Commander
https://www.ghisler.com
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

2Vlad0

If you are using windows vista or seven, you can control yourself what command processor should be used to execute your batches (using the sysnative pseudo directory)

Just add an internal association to your windcmd.ini:

Code: Select all

[searches]
Windows Command Batches_SearchFor=*.bat *.cmd
Windows Command Batches_SearchIn=
Windows Command Batches_SearchText=
Windows Command Batches_SearchFlags=0|000002000020|||||||||0000|
[Associations]
Filter1=>Windows Command Batches
Filter1_open=%windir%\sysnative\cmd.exe /C "%1" %*
Filter1.icon=%windir%\sysnative\cmd.exe
After this, you should be able to start the batch with context menu or double click.

If you want to use batches also from the command line, i suggest you to set up an alias "x64" with the command "%windir%\sysnative\cmd.exe /C". Use it as prefix before the batch filename.

The same method, as %COMSPEC% replacement can be used for button too.

(tested with TC7.50pb7 / Windows Seven x64 and x64Disableredirection=0)

HTH
Holger
___________________
Be Careful What You Wish For, It Just Might Come True.
Vlad0
Junior Member
Junior Member
Posts: 9
Joined: 2009-07-15, 16:20 UTC

Post by *Vlad0 »

Great!!! :D
I've just copy/pasted the lines to Wincmd.ini and now I am able
1) to start .cmd files launching progs from the real system32;
2) Which is much more important: to launch progs from system 32
(like msconfig) from TC button bar.

As to the possibilyty to start batch files from TC command line --
I very rarely use this possibility, preferring to just click on the batch
file. So this is not that essential.

Thanks a lot! I think Your post must be added to FACs -- I was
surely not the only person encountering these problems.
atrant
Junior Member
Junior Member
Posts: 3
Joined: 2010-02-02, 18:24 UTC

can't launch with double click

Post by *atrant »

Hello to everyone! I used the solution discussed here and now I can launch bats with context menu by clicking with right mouse button. But double click is not working. Please, explain in a little more details about x64 alias or what should I do? Thanks in advance!
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

:arrow: Configuration -> Options... :: last section "Misc"

:arrow: Select "(o) alias" and enter

Code: Select all

x64
:arrow: Open the "Command Browser" ( [Magnifier Button] )

:arrow: Last section "Usercmd.ini"

:arrow: Button [New]

:arrow: Enter the name of the new command

Code: Select all

em_Command64
:arrow: "Change user command" dialog
Command:

Code: Select all

%windir%\sysnative\cmd.exe /C
Parameter:

Code: Select all

%A
Icon file:

Code: Select all

%windir%\sysnative\cmd.exe
ToolTip:

Code: Select all

Execute x64 command processor
:arrow: [Ok] to close the "Change user command" dialog

:arrow: [Ok] to close the "Command Browser"

:arrow: [v] green check button right to the magnifier button to apply the new alias "x64"

:arrow: [Ok] to close the Configuration dialog.

After this you should be able to use the alias "x64" in the command line: e.g.
Drive:\Path> wrote:x64 NameOfThex64Batch.cmd
HTH
Holger
atrant
Junior Member
Junior Member
Posts: 3
Joined: 2010-02-02, 18:24 UTC

wow thanks

Post by *atrant »

it is really easy to command line now! I wish I could plus your reputation =)
And... mmm what about double click? I have no ideas why it is not working for me though I've added x64Disableredirection=0 to the [Configuration] section in wincmd.ini =((
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Re: wow thanks

Post by *HolgerK »

atrant wrote:... mmm what about double click?
If you rename the extension from .bat to .cmd, it should work.

See also:
ghisler(Author) wrote:Indeed exe, com, bat and lnk files are treated differently than other files: The default verb cannot be overridden via internal associations,...While the former is intentional so the user doesn't accidentally disable programs by defining a *.* internal association,...
so actually this seems to be "by design".

Regards
Holger
atrant
Junior Member
Junior Member
Posts: 3
Joined: 2010-02-02, 18:24 UTC

Post by *atrant »

Your advice helped me so much! It works for me now! Thanks a lot =)
Post Reply