Export (0) Print
Expand All
Expand Minimize

Converting the FileSystemObject's Skip Method


Windows PowerShell


Definition: Skip over the first n number of characters when reading a line from a text file.

Skip


Use Get-Content and the -totalcount paramenter to retrieve the first line from the text file. To skip the first 5 characters, start with item 5 (the sixth item in the array) and read the rest of the line up to the length of the array.


$a = Get-Content test.txt -totalcount 1
$a[5..$a.length]


Keep in mind that this code returns an array rather than a string. Also note that in Windows PowerShell 1.0, the -totalcount parameter works with only one line.


See conversions of other FileSystemObject methods and properties.
Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft