Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

This question is for aikimark only, thanks!

Posted on 2002-04-02
5
162 Views
Last Modified: 2010-05-02
aikimark,

I tired Shell("tracert " & strmachinename & " > " & App.Path & "\paths.lst"), it didn't work.

Dim MachineName As String
Dim ReturnCode As Integer
MachineName = "gluon"
ReturnCode = Shell("tracert " & MachineName & " > " & "c:\vbwork\traceroute\tracert.txt")

It did not write anything to the file.  "gluon" is a working machine, I could tracert it under DOS.

Thanks,
hxia


0
Comment
Question by:hxia
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 6913932
I saw your previous message on this, so I'll help out.

On Windows, certain "DOS" commands require a prefix command to "jumpstart them.  The two choices are "start" and "cmd".  Try something like this:

ReturnCode = Shell("cmd /c tracert " & MachineName & " > " & "c:\vbwork\traceroute\tracert.txt")

For Win95/98/ME systems, replace cmd with command.  FYI, the /c will close the DOS window when the command completes.  Also, this may not work on XP without a special plug-in (or so I've heard.)
0
 

Author Comment

by:hxia
ID: 6914049
Hi rspahitz,

Thanks!  Actually, I was able to tracert just using that coding, but could not write to the file.  If i just do this, Shell("tracert " & MachineName), it'll work, and I can see the output on the console.

I tried with cmd, still couldn't write to a file.

hxia
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 50 total points
ID: 6914098
I had problems with the original, but on my Win2000 machine, this worked (althogh delayed because the trace took a while):

  Shell ("cmd /c tracert www.microsoft.com > " & "c:\tracert.txt")

Make sure that you have a valid result path.
Also make sure that you wait until the DOS window (launched by Shell) completes before looking for the file.
0
 

Author Comment

by:hxia
ID: 6914170
Yep, it worked.  Thanks!
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6914260
Glad to help.  I hope aikmark won't get upset ;)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vb6 connector to mongodb 2 121
Export Data to Different .csv Files 26 114
how to Classify of email (pdf attachments) 7 45
Powerpoint 2013: Change cell reference in excel link 3 82
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question