RichardRiga
asked on
Using VBScript and FileSystemObject, can I use relative paths to copy files from one folder to another?
Hello, I have the following directory structure:
C:\
- TestSource
FileToBeCopied.xxx
- TestDestination
TestCopyFile.vbs
I call the TestCopyFile.vbs with cscript from a DOS prompt and the .vbs contains the following:
dim objFSOPatch, testPath
tDest = ".\TestDestination\"
set objFSOPatch = CreateObject("Scripting.Fi leSystemOb ject")
objFSOPatch.CopyFile ".\TestSource\FileToBeCopi ed.xxx", tDest, True
set fso=Nothing
However, this does not appear to work. Can I not use relative pathing for this? Can someone make the change that will fix this for me, please?
Thank you!
C:\
- TestSource
FileToBeCopied.xxx
- TestDestination
TestCopyFile.vbs
I call the TestCopyFile.vbs with cscript from a DOS prompt and the .vbs contains the following:
dim objFSOPatch, testPath
tDest = ".\TestDestination\"
set objFSOPatch = CreateObject("Scripting.Fi
objFSOPatch.CopyFile ".\TestSource\FileToBeCopi
set fso=Nothing
However, this does not appear to work. Can I not use relative pathing for this? Can someone make the change that will fix this for me, please?
Thank you!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hyper, that first link i'd already looked at and tried to emulate but haven't gotten to work.
The second one only mentions that it is possible to use a relative path but shows no example for it specifically. What am I doing wrong in MY example?
The second one only mentions that it is possible to use a relative path but shows no example for it specifically. What am I doing wrong in MY example?
ASKER
lol ok i posted that last while you posted that second. i'll check it out now thanks
ASKER
Thanks so much, that helped a ton.
http://help.lockergnome.com/general/open-relative-path-VBScript--ftopict54500.html
http://msdn.microsoft.com/en-us/library/e1wf9e7w(v=vs.85).aspx