Results 1 to 3 of 3

Thread: How to suppress command prompt in vbscript

  1. #1
    Join Date
    Jun 2009
    Posts
    18

    Post How to suppress command prompt in vbscript

    hi everyone,

    i am running vbscript code which fetch me the DN of the server through command prompt (using dsquery) i am having more than 300 server, so each time when it invokes command prompt the DOS prompt window will appear i want this windows should be suppersed but the code should run and get its result.

    how its possible is there any possible way to do this?
    here i have given my code

    Option Explicit
    'dim FilePath1
    Const FilePath1 = "c:\distinguish name.txt"
    Dim objFSO,objFile,objFile1,i
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("c:\Server move list.txt", ForReading)
    Set objFile1 = objFSO.CreateTextFile(FilePath1, True)
    Const ForReading = 1
    Dim arrFileLines()
    i = 0
    Do Until objFile.AtEndOfStream
    Redim Preserve arrFileLines(i)
    arrFileLines(i)= objFile.ReadLine
    Dim objShell,objWshScriptExec,objStdOut,strline,strcom mand
    strcommand="dsquery computer -name" & Chr(32)& arrFileLines(i)
    WScript.Echo strcommand
    Set objShell = CreateObject("WScript.Shell")
    Set objWshScriptExec = objShell.Exec(strcommand)
    Set objStdOut = objWshScriptExec.StdOut
    strline=objStdOut.ReadLine
    MsgBox strline
    objFile1.WriteLine(strline)
    i = i + 1
    Loop
    objFile.Close

  2. #2
    Join Date
    Jun 2006
    Posts
    623

    Re: How to suppress command prompt in vbscript

    I found something similar which will do a similar job, obviously doesn't include ttl values etc but works never the less.

    input = InputBox("Please enter IP address(s) of machine(s) to test, each seperated by a "":"" character", "My connectivity programme")

    If input ="" Then
    WScript.Echo("Please enter IP Address(s) of Teminal(s)/Host(s) to ping computer name to Ping, each seperated by a "":"" character")

    Else

    strMachines = input
    aMachines = Split(StrMachines, ":")

    For Each machine In aMachines
    Set ObjPing = GetObject("winmgmts:")._
    ExecQuery("select * from Win32_PingStatus where address = '"_
    & machine & "'")

    For Each objStatus in ObjPing
    If IsNull(ObjStatus.StatusCode) Or objStatus.StatusCode<>0 Then
    MsgBox machine & " Is not online - Check IP and connectivity",,"my app"


    Else


    MsgBox machine & " is online and responding",,"my app"
    End If
    Next
    Next
    End If

  3. #3
    Join Date
    Jun 2009
    Posts
    18

    Re: How to suppress command prompt in vbscript

    i think you are out of my conpect i need the command prompt window should not appear for cilent whose run this code the code which i have posted working very fine? what i need is i dont want the command prompt window should appear

Similar Threads

  1. How to create ZIP Files from Command-Line via VBScript?
    By FB in forum Windows Server Help
    Replies: 10
    Last Post: 22-12-2011, 12:18 AM
  2. about the command prompt
    By Gorganzola in forum Windows Software
    Replies: 2
    Last Post: 17-10-2008, 06:24 PM
  3. How to add a variable to a shell command in a vbscript
    By Dee in forum Windows Server Help
    Replies: 4
    Last Post: 28-04-2008, 09:13 PM
  4. Command prompt "COPY" command not working in brand new Windows Vis
    By CMD COPY command not working in Vista in forum Vista Help
    Replies: 7
    Last Post: 06-02-2008, 02:50 AM
  5. Set Affinity using command prompt?
    By zachlr1@gmail.com in forum Vista Help
    Replies: 3
    Last Post: 23-12-2007, 05:09 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,946,738.89610 seconds with 17 queries