Column Property (Windows Script Host)
Returns the column number of the current character position in an input stream.
Syntax
object.Column
Arguments
- object
StdIn text stream object.
Remarks
The Column property contains a read-only integer value indicating the column number of the current character position in an input stream. The Column property is equal to 1 after a newline character is written (even before any other character is written). The StdIn, StdOut, and StdErr properties and methods work only when the script is run with CScript.exe. If the script is run with WScript.exe, an error occurs.
Legacy Code Example
The following code demonstrates the use of the Column property by reading input from the keyboard and breaking it into lines of 20 characters.
Dim Input
Input = ""
Do While Not WScript.StdIn.AtEndOfLine
Input = Input & WScript.StdIn.Read(1)
If (WScript.StdIn.Column - 1) Mod 20 = 0 Then
Input = Input & vbCrLf
End If
Loop
WScript.Echo Input
var input = "";
while (!WScript.StdIn.AtEndOfLine)
{
input += WScript.StdIn.Read(1);
if ((WScript.StdIn.Column - 1) % 20 == 0)
input += "\n";
}
WScript.Echo(input);