如题! 忘解答.

解决方案 »

  1.   

    debug.Print  asc(" ")
     32 
    chr(32)代替空格
    我碰到"号时,常用chr(34)解决。
      

  2.   

    Public Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
      

  3.   

          SourceFile = Chr(34) & SourceFile & Chr(34)
          DestFile = Chr(34) & DestFile & Chr(34)
          FileCopy SourceFile, DestFile
      

  4.   

    用2楼的API函数或得该路径的DOS名称,再复制~
      

  5.   

    带空格可以复制
    比如下面这样的FileCopy "d:\1 1 1\1.txt", "d:\2.txt"
      

  6.   

    '在VB之下直接使用
    Private Sub Command1_Click()
       FileCopy "C:\Program Files\testa b\cmd.txt", "c:\cmd.txt"
    End Sub'********************************
    'shell(DOS命令)时要将长文件名改为短文件名
    Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
    Private Sub Command1_Click()
       FileCopy Getshortname("C:\Program Files\testa b") & "\cmd.txt", "c:\cmd.txt"
    End SubPublic Function Getshortname(ByVal sLongFileName As String) As String
       Dim lRetVal&, sShortPathName$, iLen%
       sShortPathName = Space(255)
       iLen = Len(sShortPathName)
       lRetVal = GetShortPathName(sLongFileName, sShortPathName, iLen)
       Getshortname = Left(sShortPathName, lRetVal)
       jj = InStr(Getshortname, Chr(0))
       If jj > 0 Then Getshortname = Mid(Getshortname, 1, jj - 1)
    End Function