Hi NuttyBee@xxxxxx,
Adding to Rick's string formmating, you can integrate the spaces, in the
form of padding, into the format pattern. Negative values pads the string
with spaces to the right side and positive valyues to the left. In the following
format pattern, dd/MM/yyyy is 10 characters long, so add 20 to it and you'll
end up with 30. Now, negate the value (-30) to pad spaces to the right side
of the string. Do the same math for the second format pattern (-28):
"{0,-30:dd/MM/yyyy}{0,-28:hh:mm:ss}Users:{1:0}`n" -f (get-date),$users
---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar:
http://tinyurl.com/PSToolbar
> I’d like to have Powershell print a single line to a dot matrix
> printer on a parallel port.
>
> Something like this:
>
> 10/03/08 <20 spaces> 09:02:01 <20 Spaces> Users: 1<return>
> 10/03/08 <20 spaces> 09:05:01 <20 Spaces> Users: 2<return>
> 10/03/08 <20 spaces> 09:08:01 <20 Spaces> Users: 3<return>
> 10/03/08 <20 spaces> 09:11:01 <20 Spaces> Users: 1<return>
>
> Every 3 minutes, I’d query the computer and spit out another line to
> the dot matrix printer in a Courier type font.
>
> How do I go about formatting and sending the result line by line to
> the dot matrix printer?
>