问题
I'm writing a cross-platform application and I really need some basic info about the system. Not just for switching it (I could use compile variables, since I have the same code linked in platform-specific projects).
So don't tell me that knowing the platform and architecture info is useless:
Windows RT and c#
Can anybody provide me with this info, because I don't have any easy way to get it by my-self (I have no emulator/device to work with, I'm using a netbook with linux installed on it, so no VT-d capability and so on).
P.S. Please just avoid posting something like: "use qemu, use xxx, yyyy" etc. Consider that somebody might be looking for this info as well.
回答1:
Output of 'set' on a Surface RT
ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\[user]\AppData\Roaming CommonProgramFiles=C:\Program Files\Common Files COMPUTERNAME=SURFACE ComSpec=C:\windows\system32\cmd.exe FP_NO_HOST_CHECK=NO HOMEDRIVE=C: HOMEPATH=\Users\ LOCALAPPDATA=C:\Users\[user]\AppData\Local LOGONSERVER=\\MicrosoftAccount NUMBER_OF_PROCESSORS=4 OS=Windows_NT Path=C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\ PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE=ARM PROCESSOR_IDENTIFIER=ARM Family 7 Model C09 Revision 209, NVIDIA PROCESSOR_LEVEL=3081 PROCESSOR_REVISION=0209 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files PROMPT=$P$G PSModulePath=C:\windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC=C:\Users\Public SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\windows TEMP=C:\Users\[user]\AppData\Local\Temp TMP=C:\Users\[user]\AppData\Local\Temp USERDOMAIN=SURFACE USERDOMAIN_ROAMINGPROFILE=SURFACE USERNAME= USERPROFILE=C:\Users\[user] windir=C:\windows
Ok, and the platform value:
PS C:\Users\[user]> [system.environment]::OSVersion.Platform Win32NT
Note that this is from the desktop. For immersive/metro applications you will probably need a different api.
来源:https://stackoverflow.com/questions/13807142/output-of-environment-getenvironmentvariableprocessor-architecture-and-opera