Oct


Definition: Returns a string representing the octal value of a number.

 

As script writers, a question we always ask ourselves is this: where would we be without octal numbers?

 

Well, OK, good point. Still, you never know: maybe someday you willhave to use Windows PowerShell to convert a decimal value to its octal equivalent. If and when that time comes you can do this using the .NET Framework Convertclass and the ToString ( )method. Just pass ToString () two parameters:

 

·          The decimal value to be converted (in our sample command, 999).

·          The value 8(the second parameter tells .NET to convert the value to its octal equivalent).

 

In other words, dosomething like this:

 

$a = [Convert]: : ToString(999,8)

 

When you run this command and then echo back the value of $ a youshould get the following:

 

1747