Sorry if my code is wrong.
I was just trying to relate the cmd logic directly into vbscript when I look harder at the cmd code.
Seems like Obj.AddressWidth method is much easier in vbscript. (in Post #20)
vbscript is not something I look or consider scripting as my first choice of language, also there are always so much to learn...
Cheers
objShell.Run issues... I keep getting 'Path not found" errors?!?!?!
#42
Posted 07 March 2013 - 03:23 AM
I guess this will show how both GSM and I can get the same result with different methods:
Same arrangement as last time. My revised "second rated code"
:
Note that now I get the values of %PROCESSOR_ARCHITECTURE% and %PROCESSOR_ARCHITEW6432% at both the process and the system level.
32-bit IE9 is still on the bottom left and 64-bit IE9 is still on the bottom right.
So to get the OS bitness you can use the same logic that I have advocated all along, testing the values of both %PROCESSOR_ARCHITECTURE% and %PROCESSOR_ARCHITEW6432%, using either the process or the system level variables will give the same result, or you can just check the value of only the SYSTEM %PROCESSOR_ARCHITECTURE%, if you are smart enough to know that you can do that. AFAIK, you can't do the latter via CMD batch script.
Geej, I don't think the code you posted in post #37 is "wrong". I think it will work correctly, it's just that since you were testing the SYSTEM level variables, you really didn't need to test them both. Testing only %PROCESSOR_ARCHITECTURE% should give the same result.
Cheers and Regards
Spoiler
Same arrangement as last time. My revised "second rated code"
<!DOCTYPE html>
<html>
<head>
<script language="javascript">
function myFunction()
{
var Act = new ActiveXObject("WScript.Shell");
var proc_archP = Act.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%");
var proc_arch6432P = Act.ExpandEnvironmentStrings("%PROCESSOR_ARCHITEW6432%");
var SEnv = Act.Environment("System");
var proc_archS = SEnv("PROCESSOR_ARCHITECTURE");
var proc_arch6432S = SEnv("PROCESSOR_ARCHITEW6432");
alert("Process\nPROCESSOR_ARCHITECTURE=["+proc_archP+"]\nPROCESSOR_ARCHITEW6432=["+proc_arch6432P+"]\n\nSystem\nPROCESSOR_ARCHITECTURE=["+proc_archS+"]\nPROCESSOR_ARCHITEW6432=["+proc_arch6432S+"]");
}
</script>
</head>
<body>
<input type="button" onclick="myFunction()" value="Show bitness">
</body>
</html>
Note that now I get the values of %PROCESSOR_ARCHITECTURE% and %PROCESSOR_ARCHITEW6432% at both the process and the system level.
32-bit IE9 is still on the bottom left and 64-bit IE9 is still on the bottom right.
So to get the OS bitness you can use the same logic that I have advocated all along, testing the values of both %PROCESSOR_ARCHITECTURE% and %PROCESSOR_ARCHITEW6432%, using either the process or the system level variables will give the same result, or you can just check the value of only the SYSTEM %PROCESSOR_ARCHITECTURE%, if you are smart enough to know that you can do that. AFAIK, you can't do the latter via CMD batch script.
Geej, I don't think the code you posted in post #37 is "wrong". I think it will work correctly, it's just that since you were testing the SYSTEM level variables, you really didn't need to test them both. Testing only %PROCESSOR_ARCHITECTURE% should give the same result.
Cheers and Regards
This post has been edited by bphlpt: 07 March 2013 - 03:37 AM
#43
Posted 07 March 2013 - 12:58 PM
Geej, on 07 March 2013 - 01:30 AM, said:
Seems like Obj.AddressWidth method is much easier in vbscript. (in Post #20)
vbscript is not something I look or consider scripting as my first choice of language, also there are always so much to learn...
vbscript is not something I look or consider scripting as my first choice of language, also there are always so much to learn...
How difficult is the single line batch/comand using WMIC I posted in post 21?
#44
Posted 07 March 2013 - 01:16 PM
It not second rated now you are using the correct object for the tasks. You could use ExpandEnvironmentStrings to
get the w6432, it uses the process environment. My only critique is instead of alert it might of been nicer to have
it display the information in the HTA.
Example
SampleHta.png (101.64K)
Number of downloads: 5
get the w6432, it uses the process environment. My only critique is instead of alert it might of been nicer to have
it display the information in the HTA.
Example
<TITLE>Test</TITLE>
<STYLE type="text/css">
Body
{
Padding-Top:5pt;Padding-Bottom:1pt;Margin:1pt;
Font-Size:10.25pt;Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:Black;BackGround-Color:#EFE9E3;
Text-Align:Center;Vertical-Align:Top;
}
DIV
{
Font-Size:9.25pt;Font-Weight:Bold;Color:#008181;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
width:250;
}
</STYLE>
<script LANGUAGE='JScript'>
//-> Resize And Place In Approx center
window.resizeTo(327,150)
window.moveTo(screen.availWidth/2-(327/2),screen.availHeight/2-(150/2))
//-> Onload
window.onload=function(){
var Act = new ActiveXObject("WScript.Shell");
var Env = Act.Environment("System")
var W6432 = Act.ExpandEnvironmentStrings("%PROCESSOR_ARCHITEW6432%");
Tx1.innerHTML= '<TABLE>PROCESSOR_ARCHITECTURE=['+Env("PROCESSOR_ARCHITECTURE")+']<TABLE>'+
'<TABLE>PROCESSOR_ARCHITEW6432=['+W6432+']<TABLE>'}
</SCRIPT>
<BODY><DIV ID='Tx1'> </DIV></BODY>
SampleHta.png (101.64K)
Number of downloads: 5
#45
Posted 07 March 2013 - 08:57 PM
Yzöwl, on 07 March 2013 - 12:58 PM, said:
Geej, on 07 March 2013 - 01:30 AM, said:
Seems like Obj.AddressWidth method is much easier in vbscript. (in Post #20)
vbscript is not something I look or consider scripting as my first choice of language, also there are always so much to learn...
vbscript is not something I look or consider scripting as my first choice of language, also there are always so much to learn...
How difficult is the single line batch/comand using WMIC I posted in post 21?
Certainly not hard at all. I always have this "WOW' or "awesome" feeling for a single line code.
I wonder why David Wang comes up with such a confusing method using batch. He certainly confuse me
- ← Returning a filename from within a For Each statement...
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Disable Dynamic Frequency Scaling →



Help


Back to top









