Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Thread Tools Search this Thread
Old 13-07-2009
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
MsgBox strline
i = i + 1
Reply With Quote
Old 13-07-2009
Join Date: Jun 2006
Posts: 620
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")


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"


MsgBox machine & " is online and responding",,"my app"
End If
End If
Reply With Quote
Old 14-07-2009
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
Reply With Quote

  TechArena Community > Software > Software Development
Tags: , , , ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

All times are GMT +5.5. The time now is 01:21 PM.