Only one loader for both 32 and 64-bit TC? Dedect OS-bitness
Moderators: Hacker, petermad, Stefan2, white
Only one loader for both 32 and 64-bit TC? Dedect OS-bitness
Hi,
If you use Windows x32, u need to manually launch the Totalcmd.exe file.
If you use Windows x64, u need to manually launch the TOTALCMD64.EXE file.
Is there a way to have only one launcher who can automatically detect the version of windows (x32 or x64) and launch the appropriate version of TC ?
It's for a batch file !
Thank You ...
If you use Windows x32, u need to manually launch the Totalcmd.exe file.
If you use Windows x64, u need to manually launch the TOTALCMD64.EXE file.
Is there a way to have only one launcher who can automatically detect the version of windows (x32 or x64) and launch the appropriate version of TC ?
It's for a batch file !
Thank You ...
Sure. This should doAdapt the paths to your needs.
Note that it's not always useful to launch TC x64 on Windows x64. Sometimes you need TC x86 on Windows x64.
[EDIT]
I've changed the code above to fix some errors. Note that this script does not launch TC if it is run on a 32 bit CMD on Windows x64 (because of the mixup of path and exe)!
[/EDIT]
Regards
Dalai
Code: Select all
@echo off
REM Assume 32 bit
set "tcdir=%ProgramFiles%\Total Commander"
set tc=totalcmd.exe
REM If this env var is not empty, we are on a 64 bit system
if NOT "%ProgramFiles(x86)%"=="" (
set tc=totalcmd64.exe
)
if exist "%tcdir%\%tc%" start "" "%tcdir%\%tc%"
Note that it's not always useful to launch TC x64 on Windows x64. Sometimes you need TC x86 on Windows x64.
[EDIT]
I've changed the code above to fix some errors. Note that this script does not launch TC if it is run on a 32 bit CMD on Windows x64 (because of the mixup of path and exe)!
[/EDIT]
Regards
Dalai
Last edited by Dalai on 2016-02-02, 11:52 UTC, edited 1 time in total.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
I have been using the following in the past... but most of the time i just launch the x64 directly.
The relative path needs to be changed to your needs.
Code: Select all
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT
echo 32-bit OS
START "" ..\Programs\totalcmd\totalcmd.exe
goto END
:64BIT
echo 64-bit OS
START "" ..\Programs\totalcmd\TOTALCMD64.EXE
:END
To islogged:
You got a batch file as you asked for.

Anyhow I can confirm, that silencer's "AMD64" example works perfectly, now that you are 'too busy' to test the stuff, other people took their time to make for you.
BTW: Previous, I use "%PROCESSOR_ARCHITECTURE%"=="AMD64" a lot for detecting x32 /x64 versions of portable programs. Now all of my (and most of my friend's) Windows versions are x64, so detection is no so important anymore..
To silencer: Kill the 'mobius' ant already...

You got a batch file as you asked for.


Anyhow I can confirm, that silencer's "AMD64" example works perfectly, now that you are 'too busy' to test the stuff, other people took their time to make for you.
BTW: Previous, I use "%PROCESSOR_ARCHITECTURE%"=="AMD64" a lot for detecting x32 /x64 versions of portable programs. Now all of my (and most of my friend's) Windows versions are x64, so detection is no so important anymore..
To silencer: Kill the 'mobius' ant already...

HerbieH*
-Keep on makin' music!
-Keep on makin' music!
Hum, no i never ask for a batch file solution, it's a misunderstanding ...You got a batch file as you asked for. Smile Smile
I told "It's for a batch file" ...
It's mean in one of my batch file i call the line : start TOTALCMD.EXE /i= etc... but it can't work if i execute on a x64 system ...
And if i put the line : start TOTALCMD64.EXE /i= etc... of course i've exactly the same problem if i execute it on a x32 system ...
I imagined we can detect the x32/x64 system first in the batch and launch the appropriate version of TC after ... (like Silencer or Dalai told)
But before i wanted to check here to know if TC come with some options to detect the host version system (x32/x64) in his code ... <--- just the subject of my question ^^
But it seam the answer is :
No, TC can't detect this by himself, you need to do it with/in your batch file ...
I already thank for that ^^
No worry, just the time to be busy with my batch file again ^^now that you are 'too busy' to test the stuff, other people took their time to make for you.
Thanks for All
In case you are calling the batch file from an already running TC instance (button or command line) you can always use the environment variable %COMMANDER_EXE% to start a TC with the same bitness as the running TC.islogged wrote:It's mean in one of my batch file i call the line : start TOTALCMD.EXE /i= etc... but it can't work if i execute on a x64 system ...
Regards
Holger
2islogged
From your previous posts, it seems that you believe that you can only run TOTALCMD64.EXE on x64 Windows, but you can just as well run TOTALCMD.EXE
That is not true - you CAN run totalcmd.exe on a x64 sytem (provided that you have installed 32bit TC on that system), but you are right that you cannot run TOTALCMD64.EXE on a x86 (32bit) system.start TOTALCMD.EXE /i= etc... but it can't work if i execute on a x64 system ...
From your previous posts, it seems that you believe that you can only run TOTALCMD64.EXE on x64 Windows, but you can just as well run TOTALCMD.EXE
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
That is not true - you CAN run totalcmd.exe on a x64 sytem (provided that you have installed 32bit TC on that system)
Yeah, i don't know why i wrote that ???From your previous posts, it seems that you believe that you can only run TOTALCMD64.EXE on x64 Windows, but you can just as well run TOTALCMD.EXE
It's a mistake ^^ (sorry)
Anyway, we can imagine to prefer launch a x64 version on a x64 system, to solve some problems of path (dixit: C:\Windows\SysWow64, C:\Windows\system32) and others ...
Just if I may counsel the author about this subject, we can imagine about 3 .exe files (just for a clean logic of the thing)
- Totalcmd32.exe file for x32 (or x64) system
- Totalcmd64.exe file for x64 system
- And a Totalcmd.exe file who can detect the host system version and launch the appropriate version of TC, for the most novices users of TC ...
It's just an idea ^^
Thanks for all of you and this community ...
2islogged
Just make the link file for TC and replace the first line (how it looks like) with the following text: where "C:\PROGRA~1\TC" is your path to TC (you need to change it for yours if you have diffrent place for TC)
Just make the link file for TC and replace the first line (how it looks like) with the following text:
Code: Select all
%ComSpec% /c if not exist "%ProgramW6432%" (start "" "C:\PROGRA~1\TC\TOTALCMD.EXE") else (start "" "C:\PROGRA~1\TC\TOTALCMD64.EXE")