Jump to content

Bat to check for win10 ver 64 bit or 32bit plus add


rcrrich

Recommended Posts

I am trying to see why win 10 does not understand my bat file. I have been all over the web for days now and can't find one

please that can fix this as when I run it it says that there is no such thing as echo 64 bit system:

@echo off

md c:\e4u_storm

copy ocx\*.dll c:\e4u_storm

if "%PROCESSOR_ARCHITECTURE%"=="x86" goto x86

echo 64 bit system


c:\windows\syswow64\regsvr32 c:\e4u_storm\dbvxft.dll /s
c:\windows\syswow64\regsvr32 c:\e4u_storm\dm.dll /s
c:\windows\syswow64\regsvr32 c:\e4u_storm\envxrf.dll /s

pause

exit

:x86

echo 32 bit system


c:\windows\system32\regsvr32 c:\e4u_storm\dbvxft.dll /s
c:\windows\system32\regsvr32 c:\e4u_storm\dm.dll /s
c:\windows\system32\regsvr32 c:\e4u_storm\envxrf.dll /s

pause

exit

Link to comment
Share on other sites


Which Windows 10?

32 bit or 64 bit?

And (for *whatever reason*) a 64 bit using the 32 bit cmd.exe? :w00t:

There are several ways to check OS, the one you posted seemns fine, but if it doesn't work, see if any of the alternative work for your particular OS/setup:

https://stackoverflow.com/questions/12322308/batch-file-to-check-64bit-or-32bit-os

More generally (and as a side, side note), the batch is IMHO a bit "redundant", I would simplify it along the lines of:

@echo off
md c:\e4u_storm
copy ocx\*.dll c:\e4u_storm

IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
SET Target_Path=c:\windows\syswow64\
) ELSE (
SET Target_Path=c:\windows\system32
)
ECHO %PROCESSOR_ARCHITECTURE%
%Target_Path%regsvr32 c:\e4u_storm\dbvxft.dll /s
%Target_Path%regsvr32 c:\e4u_storm\dm.dll /s
%Target_Path%regsvr32 c:\e4u_storm\envxrf.dll /s

 But more than that "as is" it seems (to me) pointless :w00t::ph34r:,

I mean, no matter if the system is 32 bit or 64 bit, the regsvr32.exe will be in %PATH%, i.e. no matter if it is in c:\windows\syswow64\ or c:\windows\system32\ (or the OS is on another drive, like D:\ or E:\ ) the OS will find and execute it when invoked by simply "regsvr32" or (better) "regsvr32.exe", it is when - for *whatever reason* you want to execute a particular version of an executable and not the one coming with the OS that you need to invoke it with an explicit path.

Maybe what you posted is just the "initial part" of a more complex batch, and then there may be other reasons for selecting the "bitwidth" of the OS.

However you want to open a command prompt and type manually "echo 64 bit system".

What happens?

Try echoing something else, like "echo here".

What happens?

jaclaz

 

 

Link to comment
Share on other sites

There are flaws to this method of detection, unless this cmd is to used in a controlled environment. The reason being is that you can install a 32bit OS on a computer with a 64bit processor. All we know for a fact is that:

1. a 32bit CPU can only have 32bit Windows installed
2. a 64bit CPU can have 32bit or 64bit Windows installed

Also the presence of a Syswow64 folder is not good because it can be created on a 32bit OS (but serve no purpose) OR can be created by misbehaving installers/programs!

You'd think if you wanted to find the architecture of the OS, you would only need to read a value relating specifically to that and not some other things that only might be correct most of the time.

Instead, you can read out of WMI to find this info, or parse the output of WMIC. This will work from Vista and newer OS:

wmic os get osarchitecture

It reads from the Win32_OperatingSystem class:

https://msdn.microsoft.com/en-us/library/aa394239(v=vs.85).aspx

Link to comment
Share on other sites

1 hour ago, Tripredacus said:

The reason being is that you can install a 32bit OS on a computer with a 64bit processor. All we know for a fact is that:

1. a 32bit CPU can only have 32bit Windows installed
2. a 64bit CPU can have 32bit or 64bit Windows installed

Yes and no. :w00t:

Sure it is not at all "always valid" (hence the given link to an ample discussion about this and "better" methods) , however - just for the record - the good MS-guys are attempting to make it "valid" as a side effect (or collateral damage) of  pushing the senseless UEFI machines, that require an "alignment" between OS and processor bitwidth,  

Unfortunately, before or later, they will win. :(

 

jaclaz

 

 

Link to comment
Share on other sites

On Τετάρτη, 29 Νοεμβρίου 2017 at 7:54 PM, rcrrich said:

echo 64 bit system

As far as I know if there are spaces in a command line then you must use initials. Try "echo 64 bit system" (with the initials).

Link to comment
Share on other sites

10 minutes ago, HarryTri said:

As far as I know if there are spaces in a command line then you must use initials. Try "echo 64 bit system" (with the initials).

Well, no, you mean quotes, not initials, but

echo "64 bit system"

should output:

"64 bit System"

whilst:

echo 64 bit system

should output:

64 bit system

The need for quotes is for PATHs containing spaces.

jaclaz

Link to comment
Share on other sites

23 hours ago, jaclaz said:

Yes and no. :w00t:

Sure it is not at all "always valid" (hence the given link to an ample discussion about this and "better" methods) , however - just for the record - the good MS-guys are attempting to make it "valid" as a side effect (or collateral damage) of  pushing the senseless UEFI machines, that require an "alignment" between OS and processor bitwidth,  

Unfortunately, before or later, they will win. :(

 

jaclaz

It is the yes in a normal world. However in this UEFI world, things are a bit more complicated. The part I posted is still true, but with UEFI we have this:

1. 32bit CPU with UEFI that allows booting 32bit EFI applications
2. 64bit CPU with UEFI that allows booting 32bit EFI applications
3. 64bit CPU with UEFI that allows booting 64bit EFI applications
4. 64bit CPU with UEFI that allows booting 32bit and/or 64bit EFI applications
5. 64bit CPU with UEFI that allows booting 32bit and/or 64bit EFI applications under special circumstances

I almost forgot about the board I once worked with that fell into 2, 3 and 5 of that list on different BIOS versions.

The underlying facts still remain that in any case a 64bit CPU can run either architecture, but a 32bit CPU can't run 64bit but could run 16bit. And I think a 64bit CPU could run 16bit also....

There was news recently that Intel says they are going to get rid of CSM or the ability to boot legacy OS on their boards, by 2018 or 2019. I surmise this means that those future chipsets will only be able to boot EFI applications on GPT. I wonder what this means for DOS. :'(

 

Link to comment
Share on other sites

Hi everyone,

Thanks for the replies and help on this but for some reason I tried this :

@echo off md c:\e4u_storm  copy ocx\*.dll c:\e4u_storm IF "%PROCESSOR_ARCHITECTURE%"=="x86" ( SET Target_Path=c:\windows\syswow64\ ) ELSE ( SET Target_Path=c:\windows\system32 ) ECHO %PROCESSOR_ARCHITECTURE% %Target_Path%regsvr32 c:\e4u_storm\dbvxft.dll /s %Target_Path%regsvr32 c:\e4u_storm\dm.dll /s %Target_Path%regsvr32 c:\e4u_storm\envxrf.dll /s

Well I just copied from above and it came out like above but that is not how it looks in the bat file.

What I get is this

Processor is AMD64 but it is not an AMD it is an Intel(R) Core(TM) i7-6820HK CPU @ 2,70GHz

64-bit Operating System. x64-based processor in Windows 10 home

Also it still does not enter any dll to the reg it just stops at saying the ver ADM64. I guess this is alot harder than it seems to be

 

Thanks for your help on this

Richard

Link to comment
Share on other sites

Well, you need to be more accurate and provide what you actually get.

Of course, at least when experimenting you should open a command prompt and invoke the batch from there,

The batch won't "stop" until all lines have been parsed and executed, maybe it doesn't work, but it should give you an error of some kind.

Anywyay, now that we know that its usage is intended on 10 and similar, open a command prompt and in it only type the command Tripredacus suggested:

wmic os get architecture

The software of this board tends to suck, particularly in combination with some browsers, and copy/paste, though using the "Code" tags (that in this release you can obtain exclusively by clicking on the button with symbol "<>" (remember to choose "No Syntax Highlighting") it is usually manageable.

Anyway, the .dll's that you are trying to re-register are 32 bit, right?

So you need to always use the 32 bit version of regsvr32.exe, this can be done more simply with:

SET MyCommand=c:\windows\system32\regsvr32.exe

IF EXIST c:\windows\syswow64\regsvr32.exe SET Mycommand=c:\windows\syswow64\regsvr32.exe

%MyCommand% c:\e4u_storm\dbvxft.dll /s 

%MyCommand% c:\e4u_storm\dm.dll /s 

%MyCommand% c:\e4u_storm\envxrf.dll /s

Normally on a 32 bit system there won' t be any \syswow64\ folder, and even if there is one, in it there won't be a regsvr32.exe. 

And you can remove the "hardcoding" of the C;\ by using environment variables:

SET MyCommand=%WINDIR%\system32\regsvr32.exe

IF EXIST %WINDIR%\syswow64\regsvr32.exe SET Mycommand=%WINDIR%\syswow64\regsvr32.exe

%MyCommand% c:\e4u_storm\dbvxft.dll /s 

%MyCommand% c:\e4u_storm\dm.dll /s 

%MyCommand% c:\e4u_storm\envxrf.dll /s

jaclaz

 

Edited by jaclaz
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...