Maystyle :
Admin : New post
Guestbook
Local
media
Catergories
Recent Articles
Recent Comments
Recent Trackbacks
Calendar
Tag
Archive
Link
Search
 
  VBS 자주 쓰는 항목 
작성일시 : 2009. 12. 24. 15:25 | 분류 : Windows Server/ETC

입력 파라미터 받기

If (Wscript.Arguments.Count < 1) Then 
    Wscript.Echo "Required Parameter missing" 
    Wscript.Quit 
End If
strName = Wscript.Arguments(0)   
Wscript.Echo strName

CMD 실행 하기

Dim oShell
Set oShell = WScript.CreateObject ("WScript.shell")
oShell.run "cmd /c echo " & "hi"
Set oShell = Nothing

배열을 이용하여 파일 읽기 각 항목 저장하기

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("\\sldc.sl.lab\print\g.txt", ForReading)

Const ForReading = 1
Dim arrFileLines()
i = 0
Do Until objFile.AtEndOfStream
    Redim Preserve arrFileLines(i)
    arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close

On Error Resume Next


For Each strLine in arrFileLines
    WScript.Echo strLine
Next

|