This script used to run fine, then we suddenly started to get the 800A004C error - "Path not found".
The error occurs on the line that states "fs.createFolder(currpath)".
'=============================================
' VARIABLES
'=============================================
' Base Variables
Set wshell = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
strUserName = cmd("echo %username%") ' Set variable to the Windows login user name
'strProfilePath = cmd("echo %userprofile%")
strProfilePath = "H:"
strLocalUserProfiledirectory= strProfilePath & "\VMFGINI\"
strInstallDirectory = "C:\Infor\VISUAL Enterprise\VISUAL Manufacturing"
strStdINIDirectory = "\\SUSCDCSQLN02\visual\Admin654\Standard INI Files"
'=================================================================================================
'=============================================
' PROGRAM - Check to see if the program had been run before else begin
'=============================================
if not fs.fileexists(strLocalUserProfiledirectory & "Visual.ini") then
makefolder strLocalUserProfiledirectory
end if
addreg
cpyStdIni(strLocalUserProfiledirectory)
'msgbox "Visual has been configured"
deletebuildinfo
'=============================================
'FUNCTIONS
'=============================================
'---------------------------------------------
function makeFolder(strFolder)
'---------------------------------------------
foldersplit = split(strFolder,"\")
for each folderitem in foldersplit
currpath = currpath & folderitem & "\"
if not fs.folderexists(currpath) then
fs.createFolder(currpath) end if
next
end function
'---------------------------------------------
function addreg()
'---------------------------------------------
wshell.RegWrite "HKEY_CURRENT_USER\Software\Infor Global Solutions\VISUAL Manufacturing\Configuration\Local Directory", strLocalUserProfiledirectory
wshell.RegWrite "HKEY_CURRENT_USER\Software\Infor Global Solutions\VISUAL Manufacturing\Configuration\InstallDirectory", strInstallDirectory
end function
'---------------------------------------------
function deletebuildinfo()
'---------------------------------------------
wshell.Run "cmd /C REG DELETE HKCU\Software\Identification\other\buildinformation /va /f"
wshell.Run "cmd /C REG DELETE HKEY_LOCAL_MACHINE\Software\Identification\other\buildinformation /va /f"
end function
'---------------------------------------------
Function Cmd(cmdline) ' Function to get results from a console command
'---------------------------------------------
fOut = fs.GetTempName
sCmd = "%COMSPEC% /c " & cmdline & " >" & fOut
wshell.Run sCmd, 0, True
If fs.FileExists(fOut) Then
If fs.GetFile(fOut).Size>0 Then
Set OutF = fs.OpenTextFile(fOut)
Cmd = trim(replace(OutF.Readall,vbcrlf,""))
OutF.Close
End If
fs.DeleteFile(fOut)
End If
End Function
'------------------------------------------------------------
Function cpyStdIni(sPath)
'------------------------------------------------------------
' Copy standard ini files
dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
' Don't copy Visual.ini file
' filesys.CopyFile strStdINIDirectory & "\Visual.ini", sPath
filesys.CopyFile strStdINIDirectory & "\*.vms", sPath
end function
The error occurs on the line that states "fs.createFolder(currpath)".
'=============================================
' VARIABLES
'=============================================
' Base Variables
Set wshell = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
strUserName = cmd("echo %username%") ' Set variable to the Windows login user name
'strProfilePath = cmd("echo %userprofile%")
strProfilePath = "H:"
strLocalUserProfiledirectory= strProfilePath & "\VMFGINI\"
strInstallDirectory = "C:\Infor\VISUAL Enterprise\VISUAL Manufacturing"
strStdINIDirectory = "\\SUSCDCSQLN02\visual\Admin654\Standard INI Files"
'=================================================================================================
'=============================================
' PROGRAM - Check to see if the program had been run before else begin
'=============================================
if not fs.fileexists(strLocalUserProfiledirectory & "Visual.ini") then
makefolder strLocalUserProfiledirectory
end if
addreg
cpyStdIni(strLocalUserProfiledirectory)
'msgbox "Visual has been configured"
deletebuildinfo
'=============================================
'FUNCTIONS
'=============================================
'---------------------------------------------
function makeFolder(strFolder)
'---------------------------------------------
foldersplit = split(strFolder,"\")
for each folderitem in foldersplit
currpath = currpath & folderitem & "\"
if not fs.folderexists(currpath) then
fs.createFolder(currpath) end if
next
end function
'---------------------------------------------
function addreg()
'---------------------------------------------
wshell.RegWrite "HKEY_CURRENT_USER\Software\Infor Global Solutions\VISUAL Manufacturing\Configuration\Local Directory", strLocalUserProfiledirectory
wshell.RegWrite "HKEY_CURRENT_USER\Software\Infor Global Solutions\VISUAL Manufacturing\Configuration\InstallDirectory", strInstallDirectory
end function
'---------------------------------------------
function deletebuildinfo()
'---------------------------------------------
wshell.Run "cmd /C REG DELETE HKCU\Software\Identification\other\buildinformation /va /f"
wshell.Run "cmd /C REG DELETE HKEY_LOCAL_MACHINE\Software\Identification\other\buildinformation /va /f"
end function
'---------------------------------------------
Function Cmd(cmdline) ' Function to get results from a console command
'---------------------------------------------
fOut = fs.GetTempName
sCmd = "%COMSPEC% /c " & cmdline & " >" & fOut
wshell.Run sCmd, 0, True
If fs.FileExists(fOut) Then
If fs.GetFile(fOut).Size>0 Then
Set OutF = fs.OpenTextFile(fOut)
Cmd = trim(replace(OutF.Readall,vbcrlf,""))
OutF.Close
End If
fs.DeleteFile(fOut)
End If
End Function
'------------------------------------------------------------
Function cpyStdIni(sPath)
'------------------------------------------------------------
' Copy standard ini files
dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
' Don't copy Visual.ini file
' filesys.CopyFile strStdINIDirectory & "\Visual.ini", sPath
filesys.CopyFile strStdINIDirectory & "\*.vms", sPath
end function