Can anyone tell me why this works in a folder on my root but not in my My Documents folder :rolleyes: :
Inet1.Execute , "GET main.txt " & App.Path & "\main.txt"
I'm running Win2k
Printable View
Can anyone tell me why this works in a folder on my root but not in my My Documents folder :rolleyes: :
Inet1.Execute , "GET main.txt " & App.Path & "\main.txt"
I'm running Win2k
If your program is located in the root, App.Path will end with a backslash, otherwise it won't.
If the get command only succeeds in the root, it could mean it needs double backslashes.
Try something like this:
Dim strDest as String
strDest = App.Path
If Left(strDest,1) <> "\" Then strDest = strDest & "\"
strDest = strDest & "main.txt"
strDest = Replace(strDest,"\", "\\")
Inet1.Execute , "GET main.txt " & strDest
Thanks for the response Frans but still no joy. If I try:
Inet1.Execute , "GET mainMB.txt " & "C:\mainMB.txt"
everythings perfect, but even:
Inet1.Execute , "GET main.txt " & "C:\Visual Basic\main.txt"
won't work! :confused:
It's because you have spaces in the path - try this:
Inet1.Execute , "GET main.txt " & chr(34) & "C:\Visual Basic\main.txt" & chr(34)
Inet1.Execute , "GET main.txt " & chr(34) & App.Path & "\main.txt" & chr(34)
CHR(34) = " character
Hey Buzby, thanks a lot-works great! :)
Could you just explain this to me:
"It's because you have spaces in the path"
c:\My Documents\ThisFile.TXT has a space in it
c:\Visual Basic\main.txt has a space in it.
c:\mainmb.txt hasn't got a space in it.
The GET command is obviously expecting two parameters, with spaces between them. When you use a command like:
GET main.txt c:\Visual Basic\main.txt
you are inadvertantly providing three parameters, because there is a space between Visual and Basic. To avoid these problems you have to surround the path with " quotes.
eg;
GET main.txt "c:\Visual Basic\main.txt"
Now it is parsed as two paramters, and works fine.
If you open a MS-DOS Prompt window and type:
cd \my documents
you get an error, however if you type
cd "\my documents"
you don't - for the very same reason. The CD command only expects one parameter.
Thanks Buzby, I understand now :p