如果filePath包含空格,则File.Exists(filePath)在发布模式下始终返回false [英] File.Exists(filePath) always returns false in release mode if filePath contains a white space
问题描述
大家好,
我注意到文件路径是否有空格,例如C:\ my document
\ test。 txt",函数File.Exists(filePath)总是在
发布模式下返回false。我怎么能让这个函数适用于
位于带有空白区域的目录?
谢谢!
>
试试这个:
Dim strPath As String =
Environment.GetFolderPath( Environment.SpecialFolde r.Personal).ToString
Dim strFile As String = IO.Path.Combine(strPath," Test.txt")
MessageBox.Show(IO .File.Exists(strFile).ToString)
-
新手编码器
(这只是一个名字)
我有很多目录,并且从未见过你用b $ b描述的内容。确保文件夹名称正确。什么dot.net版本
你的目标是什么?
LS
" snow" < ba ********** @ yahoo.com写了留言
新闻:11 ******************** **@m58g2000cwm.googlegr oups.com ...
大家好,
我注意到文件路径有空格,例如C:\ my document
\test.txt,函数File.Exists(filePath)总是在
发布模式中返回false 。我怎么能使这个函数适用于
位于带有空白区域的目录?
谢谢!
2月12日下午1:01,Lloyd Sheen < a ... @ b.cwrote:
我有很多目录,并且从未见过你用什么来描述你的b $ b描述。确保文件夹名称正确。什么dot.net版本
你的目标是什么?
LS
" snow" < barbara_d ... @ yahoo.com写了留言
新闻:11 ********************** @ m58g2000cwm.googlegr oups.com ...
我在VS.net 2003上使用.net框架工作1.0。文件路径是
由命令行定义。这不是一个特殊的文件夹
与否。如果只有目录名称包含空格,例如C:\ my
file \ test.txt,C:\ test file \ test.txt,则函数
File.Exists(filePath)总是返回false,即使该文件存在于
中,也可以是这个。
>
全部,
我注意到文件路径是否有空格,例如C:\ my document
\test.txt,函数File.Exists(filePath)总是在
发布模式下返回false。我怎么能让这个函数适用于
位于带有空白区域的目录?
谢谢! - 隐藏引用的文字 -
- 显示引用的文字 -
Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!
Try this:
Dim strPath As String =
Environment.GetFolderPath(Environment.SpecialFolde r.Personal).ToString
Dim strFile As String = IO.Path.Combine(strPath, "Test.txt")
MessageBox.Show(IO.File.Exists(strFile).ToString)
--
Newbie Coder
(It''s just a name)
I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net version are
you targeting?
LS
"snow" <ba**********@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote:I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net version are
you targeting?
LS
"snow" <barbara_d...@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn''t matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
>Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
- Show quoted text -
这篇关于如果filePath包含空格,则File.Exists(filePath)在发布模式下始终返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!