×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

error when running Vbscript--error 800A004C

error when running Vbscript--error 800A004C

error when running Vbscript--error 800A004C

(OP)
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

RE: error when running Vbscript--error 800A004C

Question: Where do you intialize currpath ? I may have missed it but all I see is:


foldersplit = split(strFolder,"\")
for each folderitem in foldersplit
currpath = currpath & folderitem & "\"
if not fs.folderexists(currpath) then
fs.createFolder(currpath) end if
next

Windows Haiku:

Serious error.
All shortcuts have disappeared.
Screen. Mind. Both are blank.

RE: error when running Vbscript--error 800A004C

msgbox currpath and see what it is equal to. Also, the .createFolder method will fail it any parent folder does not exist. For example, if the folder c:\temp exists and I want to create c:\temp\shows\breaking_bad, this attempt will fail because c:\temp\shows does not exist.

In the past, I'v used a recursive function to create a directory structure.

CODE

function createDirectory (strDir)
	set objFSO = CreateObject("Scripting.FileSystemObject")
	if (right(strDir, 1) = "\") then strDir = left(strDir, len(strDir) - 1)
	strParentDir = objFSO.GetParentFolderName(strDir)
	if NOT (objFSO.FolderExists(strParentDir)) then createDirectory (strParentDir)
	if NOT (objFSO.FolderExists(strDir)) then objFSO.CreateFolder (strDir)
end function

'usage
createDirectory("c:\temp\shows\breaking_bad\season1") 

-Geates

"I do not offer answers, only considerations."
- Geates's Disclaimer

http://raqxtr.sstar.com/caspdoc/html/vbscript_lang...

RE: error when running Vbscript--error 800A004C

As far as I can tell the script should work. currpath doesn't need to be initialized, because it starts as a blank string and disappears once the makeFolder function loses scope. And the makeFolder function does recursively create all the parent folders (though, a bit awkwardly).

My vote is for the script not having access to the H: drive

RE: error when running Vbscript--error 800A004C

Quote:

And the makeFolder function does recursively create all the parent folders

Is it must be contingent on system configuration? I have never experienced this.

-Geates

"I do not offer answers, only considerations."
- Geates's Disclaimer

http://raqxtr.sstar.com/caspdoc/html/vbscript_lang...

RE: error when running Vbscript--error 800A004C

Geates: I meant the OP's function called makeFolder. And I shouldn't have used the term "recursively"... What I meant is that the OP's function appears to do the job of creating the folder (including parent folders if they do not exist)

RE: error when running Vbscript--error 800A004C

Oops. I didn't even notice his function makeFolder even though it is the subject of the OP!! I guess that would make my replies moot; well, mostly :)

I would still recommend you echo strFolder before the loop begins and currpath during the loop to validate the data.

-Geates

"I do not offer answers, only considerations."
- Geates's Disclaimer

http://raqxtr.sstar.com/caspdoc/html/vbscript_lang...

RE: error when running Vbscript--error 800A004C

I should also add that 800A004C error - "Path not found". is not a vbscript error; it is a logical error. This further suggests something is wrong with the values of strFolder and currpath

-Geates
Note: It'd be nice if I was able to edit/append to my previous posts.

"I do not offer answers, only considerations."
- Geates's Disclaimer

http://raqxtr.sstar.com/caspdoc/html/vbscript_lang...

RE: error when running Vbscript--error 800A004C

Wouldn't the script give a permissions error if the running account does not have access to the H: drive path? Definitly need to follow Geates's troubleshooting path echo out those variables so that you can visually see where it is looking at. Verify the folder structure namings is correct as well, maybe someone renamed a folder or something.

Windows Haiku:

Serious error.
All shortcuts have disappeared.
Screen. Mind. Both are blank.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close