确定使用perl的Microsoft Windows版本? [英] Determine version of Microsoft Windows using perl?
本文介绍了确定使用perl的Microsoft Windows版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Windows上创建一个小的perl脚本. 我想确定Windows的版本,例如XP,Vista,7、8等. 我如何获得此信息? 谢谢.
I am creating a small perl script on Windows. I want to determine the version of Windows i.e. XP, Vista, 7, 8, etc. How can I get this information? Thank You.
更新:我想知道运行脚本的Windows版本! 我是初学者,请添加一些有关如何使用API的代码.对perl不太了解.
UPDATE: I want to know the Version of Windows on which the script is running! Please add some code on how to use the API's as I am a beginner & dont know much about perl.
推荐答案
尝试 Win32 :
#!/usr/bin/env perl
use 5.014;
use strict;
use warnings;
use Win32;
say Win32::GetOSDisplayName();
say for Win32::GetOSName();
say for Win32::GetOSVersion();
如果这还不够,您可以致电 GetVersionEx 通过 Win32 :: API .
If that is not sufficient, you can call GetVersionEx via Win32::API.
这篇关于确定使用perl的Microsoft Windows版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文