|
-
Jun 24th, 2002, 06:27 AM
#1
My Documents Problem
Can anyone tell me why this works in a folder on my root but not in my My Documents folder :
Inet1.Execute , "GET main.txt " & App.Path & "\main.txt"
I'm running Win2k
-
Jun 24th, 2002, 07:27 AM
#2
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
-
Jun 24th, 2002, 08:01 AM
#3
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!
-
Jun 24th, 2002, 08:10 AM
#4
Frenzied Member
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
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Jun 24th, 2002, 08:33 AM
#5
Hey Buzby, thanks a lot-works great! 
Could you just explain this to me:
"It's because you have spaces in the path"
-
Jun 24th, 2002, 09:25 AM
#6
Frenzied Member
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.
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Jun 25th, 2002, 01:27 AM
#7
Thanks Buzby, I understand now
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|