Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Server information via Cygwin

Status
Not open for further replies.

toddyl

Technical User
Sep 26, 2005
102
US
Hi,

I've developed a Perl script which runs on Unix/Linux servers and gets server information. Part of this script looks up things like /etc/release (or /etc/redhat-relase on Linux) and runs uname to get various OS info.

I've now been asked to find a way to run this script on our Windows servers. I looked at Cygwin and figured that was the best way of going about this. When I run the script on Cygwin I'm getting a lot of information -- however I am unable to get OS information related to Windows but instead am getting Cygwin data as output.

Does anyone know how I can run DOS commands, or even other unix commands, from Cygwin to find out the version of Windows etc.

Thanks for your help,

Tom
 
how I can run DOS commands
cmd.exe /C your dos command here

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi

CygWin receives the host operating system's environment variables. And just run whatever you want.
Code:
[blue]master #[/blue] perl -e 'print "Running NotePad in $ENV{\"OS\"}\n";system "notepad"'
Running NotePad in Windows_NT

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top