How to execute vbs file on another computer?
I use Delta Aircraft and I’ve written some sort of vbs value with which i can delete every one of the files from a certain folder.I tried it and yes it works good on my own computer but once i place the idea on a further pc, it doesn’t stop here work.How could i get this to do on many of the pc’s which can be used by airlines.Recommendations the signal I used-
Dim sFolderName, oFSO, oFolders
sFolderName = “C:\Documents and Settings\All Users\Application Data\DAL\Cornerstone”
Fixed oFSO = createobject(“scripting.filesystemobject
Fixed oFolders = oFSO.getfolder(sFolderName)
ScanFolder oFolders
Sub-contract ScanFolder(oFolders)
Dim oFiles, oFile, oFolder, oSubFolders, oSubFolder
Fixed oSubFolders = oFolders.subfolders
Fixed oFiles = oFolders.files
Per oFile Around oFiles
oFile.Delete(True)
Next
Per oSubFolder Around oSubFolders
ScanFolder oSubFolder
Whenever oSubFolder.Width = 0 Subsequently oSubFolder.Delete(True)
Next
Fixed oSubFolders = Nothing
Fixed oFiles = Nothing
End Sub
Once i copy this to another pc within the same server not surprisingly, it will not work.It provides me one message-
Glass windows script host
line-6
char-1
error-path definitely not found
Any help could be greatly prized.
Do definitely not hardcode the road:
“C:\Documents and Settings\All Users\Application Data\DAL\Cornerstone”
as this could not exist around the other COMPUTER if this can be a different OS IN THIS HANDSET than Home windows XP.
Very similar to path:
“C:\Documents and Settings\All Users\Application Data”
upon Vista and Win7 is definitely:
“C:\ProgramData”
You need to use the adhering to code to get sFolderName dynamically:
Const CommonAppData = &H23& ‘ the 2nd & denotes a lengthy integer WI
Fixed objShell = CreateObject(“Shell.Application”)
Fixed objFolder = objShell.Namespace(CommonAppData)
sFolderName = objFolder.Personal..Path & “\DAL\Cornerstone”
The following should remedy your dilemma.
Leave a Reply
You must be logged in to post a comment.