shatterstar6457
Programmer
Im getting the following error:
C:\Compile All Visual Studio Solutions.vbs(16, 1) Microsoft VBScript runtime error: Object required: '[string: "F:\Code Samples"]'
where - line 16 is this:
Set objFolderPath = objFolder.Path
-Full Code-
Option Explicit
Dim objFSO, objFile, objFolder, objSubFolder, objShell, objFolderPath,_
colFiles, colFolders, colSubFolders,_
strStartDir, strExtension, strPath,_
intCount
strStartDir = InputBox("Full path of folder to check?")
strExtension = InputBox("Please enter the File Extension To Search For")
intCount = 0
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strStartDir)
Set colFiles = objFolder.Files
Set objShell = CreateObject("WScript.Shell")
Set objFolderPath = objFolder.Path
For each objFile in colFiles
If lcase(Right(objFile.Name,3)) = strExtension Then
objShell.Run("%COMSPEC% /C devenv /useenv /out C:\MyErrorLog.txt " & objFolderPath & objFile.Name & " /build Debug"),1,TRUE
intCount = intCount + 1
Else
WScript.Echo "I found this file which is " & objFile.Name &_
" but it does not have the Extension " & strExtension
end if
Next
ScanSubFolders(objFolder)
WScript.Echo "DevEnv Found And Attempted To Compile " & intCount & " Files"
Sub ScanSubFolders(objFolder)
Set colFolders = objFolder.SubFolders
For Each objSubFolder In colFolders
Set colFiles = objSubFolder.Files
For Each objFile in colfiles
If lcase(Right(objFile.Name,3)) = strExtension Then
objShell.Run("%COMSPEC% /C devenv /useenv /out C:\MyErrorLog.txt " & objFolderPath & "\" & objFile.Name & " /build Debug"),1,TRUE
intCount = intCount + 1
Else
WScript.Echo "I found this file which is " & objFile.Name &_
" but it does not have the Extension " & strExtension
End If
Next
ScanSubFolders(objSubFolder)
Next
End Sub
C:\Compile All Visual Studio Solutions.vbs(16, 1) Microsoft VBScript runtime error: Object required: '[string: "F:\Code Samples"]'
where - line 16 is this:
Set objFolderPath = objFolder.Path
-Full Code-
Option Explicit
Dim objFSO, objFile, objFolder, objSubFolder, objShell, objFolderPath,_
colFiles, colFolders, colSubFolders,_
strStartDir, strExtension, strPath,_
intCount
strStartDir = InputBox("Full path of folder to check?")
strExtension = InputBox("Please enter the File Extension To Search For")
intCount = 0
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strStartDir)
Set colFiles = objFolder.Files
Set objShell = CreateObject("WScript.Shell")
Set objFolderPath = objFolder.Path
For each objFile in colFiles
If lcase(Right(objFile.Name,3)) = strExtension Then
objShell.Run("%COMSPEC% /C devenv /useenv /out C:\MyErrorLog.txt " & objFolderPath & objFile.Name & " /build Debug"),1,TRUE
intCount = intCount + 1
Else
WScript.Echo "I found this file which is " & objFile.Name &_
" but it does not have the Extension " & strExtension
end if
Next
ScanSubFolders(objFolder)
WScript.Echo "DevEnv Found And Attempted To Compile " & intCount & " Files"
Sub ScanSubFolders(objFolder)
Set colFolders = objFolder.SubFolders
For Each objSubFolder In colFolders
Set colFiles = objSubFolder.Files
For Each objFile in colfiles
If lcase(Right(objFile.Name,3)) = strExtension Then
objShell.Run("%COMSPEC% /C devenv /useenv /out C:\MyErrorLog.txt " & objFolderPath & "\" & objFile.Name & " /build Debug"),1,TRUE
intCount = intCount + 1
Else
WScript.Echo "I found this file which is " & objFile.Name &_
" but it does not have the Extension " & strExtension
End If
Next
ScanSubFolders(objSubFolder)
Next
End Sub