-1

为什么GetAName2在以下功能中起作用,但不是GetAName

Function isWimPathLocal(wimfilepath)
  if blnDEBUG Then WSCript.Echo vbCrLf & "Inside... isWimPathLocal()"
  'Dim filespec: filespec = wimfilepath
  Dim filespec: filespec = "Z:\install_files\7\32-bit\sources\install.wim\XXX"
  Dim GetAName: GetAName = objFSO.GetDriveName(wimfilepath)
  if blnDEBUG Then WSCript.Echo "filespec: " & filespec
  if blnDEBUG Then WSCript.Echo "wimfilepath: " & wimfilepath
  if blnDEBUG Then WSCript.Echo "GetAName: " & GetAName

  dim fso:set fso = CreateObject("Scripting.FileSystemObject")
  Dim GetAName2: GetAName2 = objFSO.GetDriveName(filespec)
  WScript.Echo "GetAName2: " & GetAName2

  'if blnDEBUG Then WSCript.Echo "wimfilepath: " & wimfilepath
     'strWimDrv = objFSO.GetDriveName(wimfilepath)
  'if blnDEBUG Then WSCript.Echo "strWimDrv: " & strWimDrv

     'intDriveType = GetDriveType(strWimDrv)
     'If intDriveType = 2 Then
     '  isWimPathLocal = TRUE
     'Else
    '   isWimPathLocal = FALSE
    'End if
   if blnDEBUG Then 
     WScript.Echo "Break... isWimPathLocal()"
     WScript.Quit
   End if
End Function

上述函数的输出为:

Inside... isWimPathLocal()
filespec: Z:\install_files\7\32-bit\sources\install.wim\XXX
wimfilepath: "Z:\install_files\7\32-bit\sources\install.wim"
GetAName:
GetAName2: Z:
Break... isWimPathLocal()
4

1 回答 1

1

字符串“wimfilepath”似乎包括它周围的引号。字符串不应该像filespec一样不带引号吗?

于 2013-09-11T20:16:17.827 回答