Computing.Net > Forums > Programming > vb shell executable results in text

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

vb shell executable results in text

Reply to Message Icon

Original Message
Name: ansari81
Date: June 27, 2005 at 11:40:19 Pacific
Subject: vb shell executable results in text
OS: windows 2000
CPU/Ram: 120 MB
Comment:

Hi,
I need to run a exe file through vb and im getting results intext file im using a code

shell("d:/message/uptime.exe /s > D:\message\uptime.txt")

the above command will work in dos command line and Batch program as well but not through VB Can any one help me to sort out this problem

Thanks!!!



Report Offensive Message For Removal


Response Number 1
Name: borelli35
Date: June 27, 2005 at 13:42:05 Pacific
Reply: (edit)

How are you attempting to make this command line call in VB?

John W. Borelli
IT Specialist
Hawkeye Security

Link to my email address


Report Offensive Follow Up For Removal

Response Number 2
Name: ansari81
Date: June 27, 2005 at 16:12:18 Pacific
Reply: (edit)

Liek below

shell("d:/message/uptime.exe /s > D:\message\uptime.txt")



Report Offensive Follow Up For Removal

Response Number 3
Name: ansari81
Date: June 27, 2005 at 16:18:10 Pacific
Reply: (edit)

Also i tried the following

DateConfirm = Date
DateConfirm = DateConfirm - 1

Shell("command.com /c d:\message\uptime.exe /s /d:" & DateConfirm & " > d:\message" & Trim(Year(DateConfirm) & Month(DateConfirm) & Day(DateConfirm)) & ".txt", vbNormalFocus)

it will work under COMMAND mode in win 2000 but not in CMD mode

Also i face a problem in command mode i could not get the full file name of the text file (EG: uptime_20050627.txt)


Report Offensive Follow Up For Removal

Response Number 4
Name: borelli35
Date: June 27, 2005 at 18:14:08 Pacific
Reply: (edit)

================================================================
I believe that you have to call command.com /c in order to get any DOS level app to successfully run but it's been a while so just give it a shot....

John W. Borelli
IT Specialist
Hawkeye Security

Link to my email address


Report Offensive Follow Up For Removal

Response Number 5
Name: ansari81
Date: July 1, 2005 at 13:08:33 Pacific
Reply: (edit)

Thanks for your reply it it will help me a lot

Could you help me on below liste problems

1.I have machines and ip address in Database (Acess)

2.i need to find out the system down time (How long system in off mode or On mode)
for all for the given time machines from a machine (consider server).

3. Get the all values and store it in to the database.

4.I need this system should do all the work in automated

From the above points. Could you please help me out to finde the system Downtime for various machines dynamicaly


Report Offensive Follow Up For Removal


Response Number 6
Name: ansari81
Date: July 1, 2005 at 14:45:53 Pacific
Reply: (edit)

Hi borelli,

Also, i Have attach my code below to you


Dim dTaskID As Double
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form_Load()

'Open the Database
If con.State = 1 Then con.Close
con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=webserver;UID=sa;PWD=sa;DATABASE=Intranet"


DateConfirm = Date 'Get the Date Value
'DateConfirm = DateConfirm - 1 'Set the dat value to onday before

'Select Record set from the table System History (tbladminhis)
If rs.State = 1 Then rs.Close
rs.Open "select * from tbladminhis", con, 3, 3

'Select all IP address or system name to find the Down time and uptime of each system
While Not rs.EOF

'Get the IP address and Sys Name for evry time

SystemIP = Trim(rs("ip"))
SystemName = Trim(rs("sname"))

'MsgBox "command.com /c c:\ansari\uptime.exe " & CompName & " /s /d:" & DateConfirm & " > c:\ansari\" & SystemName & ".txt"

'The below line is to run the uptime.exe to generate the system information as a text file

dTaskID = Shell("command.com /c c:\ansari\uptime.exe " & SystemIP & " /s /d:" & DateConfirm & " > c:\ansari\" & SystemName & ".txt", vbHide)

rs.MoveNext
Wend

If rs.State = 1 Then rs.Close
If con.State = 1 Then con.Close

Set con = Nothing
Set rs = Nothing

End Sub


Report Offensive Follow Up For Removal

Response Number 7
Name: borelli35
Date: July 7, 2005 at 23:30:03 Pacific
Reply: (edit)

Ansari,

I have to get up at 3am this morning so I will have to look at it after I get home from work tomorrow. I just wanted you to know that I have read the post and will respond as soon as I have the opportunity to check the code out. Also, if you could email me an attachment of the database or databases involved with the program it will make life much easier in terms of tracing the code. A link to my email is on the last line of this post (labeled borelli35 and underlined).

John W. Borelli
IT Specialist
Hawkeye Security
borelli35



Report Offensive Follow Up For Removal

Response Number 8
Name: ansari81
Date: July 8, 2005 at 17:33:18 Pacific
Reply: (edit)

Borelli,

Thanks for your intreast to shown on my problem and i feel sorry to disturb on ur rest time im sorry again now i have to develope some more convinient solution

I have email u the code and database structure thanks

Reagards,
A.Ansari


Report Offensive Follow Up For Removal






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software