windows:
GetUserName(LPWSTR lpBuffer, LPDWORD nSize)
lpBuffer是一个数组的地址,用来存贮得到的用户名,nsize是个指针,指向此存贮此数组大小的单元,就是数组能存贮的字符数量
GetVersionExW(LPOSVERSIONINFOW)
参数LPOSVERSIONINFO是一个指向OSVERSIONINFO类型变量的指针,
具体判断代码如下
定义 OSVERSIONINFO osvi
然后调用函数取得版本号,判断如下
switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
if (osvi.dwMajorVersion == 5&&osvi.dwMinorVersion == 0)
{
strOSVersion = TEXT("Windows 2000")
}
else if (osvi.dwMajorVersion == 5&&osvi.dwMinorVersion == 1)
{
strOSVersion = TEXT("Windows XP")
}
else if(osvi.dwMajorVersion == 6&&osvi.dwMinorVersion == 0)
{
strOSVersion = TEXT("Windows Vista")
}
else if (osvi.dwMajorVersion == 4&&osvi.dwMinorVersion == 0)
{
strOSVersion = TEXT("Windows NT")
}
break
case VER_PLATFORM_WIN32_WINDOWS:
if (osvi.dwMajorVersion == 4&&osvi.dwMinorVersion == 10)
{
strOSVersion = TEXT("Windows 98")
}
else if (osvi.dwMajorVersion == 4&&osvi.dwMinorVersion == 90)
{
strOSVersion = TEXT("Windows ME")
}
else
{
strOSVersion = TEXT("Windows 95")
}
break
default:
break
}
@echo offset "App=c:\Program Files\FlashFXP\flashfxp.exe"
wmic datafile where "Name= %App%" get Manufacturer,Version,Filename
pause
改成如此便可,
给变量加双引号防止路径空格,如此便可以了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)