[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: reading hostname into a string var in Windows
From: |
Tim Rueth |
Subject: |
RE: reading hostname into a string var in Windows |
Date: |
Mon, 20 Sep 2010 23:59:37 -0700 |
> -----Original Message-----
> From: Andy Buckle [mailto:address@hidden
> Sent: Monday, September 20, 2010 10:46 PM
> To: address@hidden
> Cc: address@hidden
> Subject: Re: reading hostname into a string var in Windows
>
> On Tue, Sep 21, 2010 at 6:37 AM, Tim Rueth <address@hidden> wrote:
> > I know there's a simple answer to this question, I just
> can't figure
> > out what it is: How do I read the hostname into a string
> variable in Octave?
> > I'm on Windows Vista.
> >
> > Thanks,
> >
> > --Tim
>
> [exitcode host]=system("echo %computername%")
>
> I tested on XP. I think this should work on Vista.
>
> --
> /* andy buckle */
>
Yes, thanks, that works. And now that I see how you did that, I also tried:
[exitcode host] = dos("hostname");
Which also worked. And thanks, A Kelly, for: getenv('COMPUTERNAME'), which
also works.
I don't know if one of these three is more robust than the others or if it
doesn't matter. They all work on both Vista and Win7.
--Tim