How do I define the pathname to a file in WIndows 10

Kenneth Brody kenbrody at spamcop.net
Tue Dec 8 10:48:08 PST 2015


On 12/8/2015 1:38 PM, Brian K. White via Filepro-list wrote:
> On 12/8/2015 1:24 PM, Kenneth Brody wrote:
>> On 12/8/2015 12:35 PM, Brian K. White via Filepro-list wrote:
>>>
>>>> or add quotes around the whole string because of the space in My
>>>> Documents:
>>>>
>>>> tf = "\""getenv("USERPROFILE"){x{"My Documents"{x{"foo.txt\""
>>>
>>> Wups, missing a { between the first "\"" and getenv() :
>>>
>>> tf = "\""{getenv("USERPROFILE"){x{"My Documents"{x{"foo.txt\""
>>
>> ... which means that instead of getting a "syntax error" in filePro,
>> you'll simply end up with an invalid filename.
>>
>> (USERPROFILE includes the drive letter, so you can't preface it with
>> "\". And, if it didn't include a drive letter, you would now have a
>> filename that starts with "\\", which in all likelihood would also be a
>> failure.)
>>
>
>
> "\""  not "\"
> It's to put quotes around the entire string because of the space in My
> Documents. Not a leading backslash
>
> "C:\users\bkw\my documents\foo.txt"
> vs
> C:\users\bkw\my documents\foo.txt

Oops.  Mea culpa.

However, unless you're passing it to SYSTEM, you can't include quotes in the 
filename.  And, if you are passing it to SYSTEM, I would recommend that you 
add the quotes when passing it to SYSTEM, rather than when building the 
filename.

-- 
Kenneth Brody


More information about the Filepro-list mailing list