in reply to how to detect whether script is being run on Windows at runtime?

lazy hack?
if (-d "C:/windows/system") { # is windows }
Not tested - I'm not on windows - but would that cover ambiguity on $^O?

cLive ;-)

  • Comment on Re: how to detect whether script is being run on Windows at runtime?
  • Download Code

Replies are listed 'Best First'.
Re: Re: how to detect whether script is being run on Windows at runtime?
by BUU (Prior) on May 10, 2004 at 23:03 UTC
    Except of course for every operating system based on winnt, which uses c:/winnt/
      Could you just check for the existence of "C:\"? How many OS's start with a letter, specifically the thrid letter in the alphabet (this is a real question)?

      Cheers,

      John

      Update:

      Apparrently you get '--'ed around here for asking what can be preceived as stupid questions. From this and BUU's comments I'll take the answer to my first question as no.

      Update 2:

      I was talking about the second question at work today with a friend. He said that OS/2 and one of the mainframe operating systems also used letters to denote drives.

        That would, of course, fail if your windows installation had no drive labeled 'C'.