61892

VB script error path Path not found(800A004C)

I need to create vbscript which will create new folder 'test' and subfolder 'Output'.There is already a folder structure C:\Documents and Settings\All Users\Application Data\Fmwire,I need to create test\Output under those structure

I have created vbscript like this but i am getting error like this

Error: Path not found Code: 800A004C Source: Microsoft VBScript runtime error

Const OSCPATH = "\Fmwire\test\Output" Const ALL_USERS_APPLICATION_DATA = &H23& Dim fso ' File System Object Dim objApplication ' Application object Dim objFolder ' Folder object Dim objFolderItem ' FolderItem object Dim fname ' Path to Settings folder Set objApplication = CreateObject("Shell.Application") Set objFolder = objApplication.Namespace(ALL_USERS_APPLICATION_DATA) Set objFolderItem = objFolder.Self fname = objFolderItem.Path & OSCPATH Set fso = CreateObject("Scripting.FileSystemObject") If fso.FolderExists(fname) Then Set objFolder = fso.GetFolder(fname) Else Set objFolder = fso.CreateFolder(fname) If Err Then Err.Clear strErr = SPOFOLDERFAIL rCode = 4 End If End If

What changes i have to do for correcting this

Answer1:

Const OSCPATH = "\Fmwire\test\Output" Const ALL_USERS_APPLICATION_DATA = &H23& Set objApplication = CreateObject("Shell.Application") Set objFolder = objApplication.Namespace(ALL_USERS_APPLICATION_DATA) Set objFolderItem = objFolder.Self fname = objFolderItem.Path Set fso = CreateObject("Scripting.FileSystemObject") folders = Split(OSCPATH, "\") For i = 0 To UBound(folders) fname = fso.BuildPath(fname, folders(i)) If fso.FolderExists(fname) Then Set objFolder = fso.GetFolder(fname) Else Set objFolder = fso.CreateFolder(fname) If Err Then Err.Clear strErr = SPOFOLDERFAIL rCode = 4 End If End If Next

Recommend

  • How do I read multiple JSON structures contained in one file?
  • Hadoop WordCount.java Dependency Issues
  • How to sign up through Rest API using AFNetworking 2.0?
  • vbscript syntax in asp classic
  • CRLF in VBScript
  • ADO Command Parameter Not Passing to Stored Procedure or Stored Procedure 'Ignoring' Param
  • System.Timers.Timer (.NET) really slow?
  • .Net Compact Framework 3.5 HTTP POST
  • Execute SQL Server stored procedure from VBA and retrieve all messages and result sets
  • Create an object whose type is in a string parameter
  • Tensorflow not predicting accurate enough results
  • Format DateAsOrdinal xAxis labels in ZedGraph
  • Copying and renaming unopened workbook in excel
  • Unselect column after pasting data
  • Convert DotNetZip ZipFile to byte array
  • VB.NET Iterating through objects of a structure
  • Alter Table doesn't work under MS Access 64 bit. Why?
  • Sorting a DataTable using LINQ, when sort-by-columns may vary
  • Passing Data between VB.NET forms
  • Access VBScript variable within Javascript inside of an HTA
  • Pasting URLs That Have Been Scraped From a Webpage
  • how to know the last row filled in vba (excel)? [duplicate]
  • Align Excel cell to center VB - xlCenter is not declared
  • Double-click autofill - dynamic based on adjacent cell
  • Excel VBA URLDownloadToFile Error for https Ressource
  • runtime error when linking ffmpeg libraries in qt creator
  • in batch how do i use taskkill properly
  • Creating a Multidimensional, Associative Array in VBScript
  • powershell Get-Counter -ComputerName parameter on Windows 7
  • Xamarin MonoAndroid Azure mobile service InsertAsync
  • Ruby on Rails App deployed to heroku showing “We're sorry, but something went wrong”
  • Detecting null parameter in preprocessor macro
  • Private IP address in reserved subnet range
  • How To Customize ASP.NET Chart Databound To SqlDataSource
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • Conversion from string “a” to type 'Boolean' is not valid
  • script to move all files from one location to another location
  • ILMerge & Keep Assembly Name
  • Symfony2: How to get request parameter
  • Run Powershell script from inside other Powershell script with dynamic redirection to file