I can't remember where I stole this code, but it will try to tell you which Windows version you're running:
Option Explicit
Dim oWSH
Set oWSH=CreateObject("WScript.Shell")
If OSver()="Windows 2000" Then
' Do Win2K code
Else
' Do non-Win2K code
End If
WScript.Quit
Function OSver...
You're losing the return value from fileThere by using Call.
Try replacing:
Call fileThere (compHost)
If fileThere=False Then
with:
If Not fileThere(compHost) Then
Try this ITSTOAST:
Dim fso
Dim path
Dim oFolder
Dim oSubFolder
Dim oSHA
Const OverwriteExisting = True
Set oSHA=CreateObject("Shell.Application")
transfer =BrowseForFolder("Select the folder containing files to transfer:")
Path=BrowseForFolder("Select Target Folder:")
Set fso =...
You don't show the original definition of arrParent.
The first declaration should either be a ReDim arrParent(n) or Dim arrParent(). If you use Dim with an actual number, the size of the array is fixed and cannot be changed using ReDim.
e.g.
Dim arrParent()
ReDim arrParent(10)
ReDim...
This should do it:
' FolderCreate.vbs - Create folders within all subfolders.
Option Explicit
Const TARGFOLDER="d:\pupils\all\my documents\tech\year 5"
Dim FSO,WSH,sNewFolder,oFolder,oSubFolder,sFullPath
Set WSH=CreateObject("WScript.Shell")
Set...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.