Hi,
I was wondering if someone can help me or have had a similar experience.
I am trying to shell ipconfig with an output to a text file which I can later parse.
sIPFileLoc is a string variable for the file location and name.Code:ShellandWait ("ipconfig >" & sIPFileLoc)
ShellandWait is a function to wait until the shell has completed(found on this very site)
Now when I run this command, it complains of an invalid syntax because of the ">" yet if I manually run the same command from a command prompt it works fine.
There is no problem with directory naming as sIPFileLoc is stripped to 8.3 file naming standards (e.g. Documents and Settings becomes Docume~1) even so, I have tried it with Chr(34) wrapped around the variable but still the same.
So I created a batch file just to see if it would work.. When running the batch file with @echo on, it outputs an additional 1 as such
command in bachfile:
Output:Code:ipconfig >c:\testdir\ip.txt
But this DOES work and creates ip.txt containing the output of ipconfig.Code:ipconfig 1>c:\testdir\ip.txt
So I altered the Shell command to incorporate the 1 (just to see)
But that did not work.Code:ShellandWait ("ipconfig 1>" & sIPFileLoc)
Now I can create a batch file on the fly, shell it then delete it once complete, but that is rather messy and was wondering if there was a work around.
PS, I can not use WinSock control to get the IP address as it is a standalone app.
Thanks




Reply With Quote