Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange objFolder.move happening ?!?!

Status
Not open for further replies.

stephenmbell

IS-IT--Management
Jan 7, 2004
109
US
I have a script.. among other things... it does the following:

----------------
'declare local variables
Dim objFSO, objFolder, strFolderPath, strNewFolderName, strCopyFolder

'initialize strings
strFolderPath = "C:\Program Files\Pinnacle\Oaswin"
strNewFolderName = "C:\Program Files\Pinnacle\Oaswin_Backup"
strCopyFolder = "D:\UPGRADES\OASISUPGRADE\Oaswin"

'create new fso
Set objFSO = CreateObject("Scripting.FileSystemObject")

'get the current oaswin folder
Set objFolder = objFSO.GetFolder(strFolderPath)

'move the current folder to the backup location
objFolder.move strNewFolderName

'Copy files from usb to hdd
Call CopyFolders(strCopyFolder, strFolderPath)

'perform cleanup
Set objFSO = Nothing
Set objFolder = Nothing
-------

inside my script, this is a procedure. When I run my script by double clicking on myscript.vbs (that includes above code) this operation completes fine.

in the grand scheme of things, this is 1 of about 3 scripts i need to run....from a batch file...
so - it goes like this

1. run d:\mybatch.bat
2. mybatch.bat runs d:\script1.vbs
3. script1.vbs calls d:\script2.vbs (which includes the above code)
4. script1.vbs calls c:\setup.exe
5. script1.vbs calls d:\script3.vbs

The problem I am having -- when I run this by doubleclicking on script2.vbs, the code runs fine - error free. when I run it by doubleclicking on d:\mybatch.bat, I get an error when trying to:

objFolder.Move strNewFolderName

(the copy folders is a procedure .. pass it 2 paths and it copies source to destination..)

The error I receive is Permission Denied. I know that I am working across different drives,

Any idea why???

Thanks in advance.

sb
 
Are you sure that script1.vbs (or mybatch.bat) does nothing with "C:\Program Files\Pinnacle\Oaswin" ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Mybat.bat contains the following..

D:\folder\script1.vbs

script1.vbs contains the following procedure:

Sub RunProgram(strProgramPath)

'declare local variables
Dim objShell

'go to these files in explorer
Set objShell = CreateObject("WScript.Shell")

'run the program
objShell.Run chr(34) & strProgramPath & Chr(34), 1, True

'perform cleanup
Set objShell = Nothing

End Sub


and basically is passes about 6 or 7 strings to the run program procedure calling the various scripts/exe's i need to be run

thanks. hope this helps.
sb
 
What if you changed:

strNewFolderName = "C:\Program Files\Pinnacle\Oaswin_Backup"

to

strNewFolderName = "C:\Program Files\Pinnacle\Oaswin_Backup\"


--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top