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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help using variables in movefolder method

Status
Not open for further replies.

Jerz

MIS
Sep 10, 2004
102
US
Code:
Set FSo = CreateObject("Scripting.FileSystemObject")
var1 = Chr(34) & "\\Server\Share$\Folder1\Folder2" & Chr(34)
var2 = Chr(34) & "\\Server\Share$\" & Chr(34)
'also tried next two lines - no difference:
'var1 = """\\Server\Share$\Folder1\Folder2"""
'var2 = """\\Server\Share$\"""

wscript.echo var1 & vbcrlf & var2

'always appear to have quoted valid content

'Next line fails with "Bad file name or number", 
'Code: 800A0034 on Char:1

fso.movefolder var1,var2

'below works every time, but I need to use variables

'fso.movefolder "\\Server\Share$\Folder1\Folder2","\\Server\Share$\"
 
OK, I got it.

vars work without quotes altogether. Seems as though that's where I started, but anyhow it's working now.
 
var1 = "\\Server\Share$\Folder1\Folder2"
var2 = "\\Server\Share$\"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top