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

GetFile problem 2

Status
Not open for further replies.

TheStoneman

IS-IT--Management
Nov 29, 2007
5
US
Can someone help me with this problem?

Set fso = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1
WScript.Echo objArgs(I)
Set Myfile = fso.GetFile("WScript.Echo objArgs(I)")
MyFile.Copy ("C:\")

Next


'Set Myfile = fso.GetFile("c:\documents and settings\rstone.act-ia\desktop\test.txt")

I can drag a file and it echos the path and file name but the line to set Myfile says file not found. The commented line at the end works fine. How can I place the results of the WScript.Echo objArgs(I) into the GetFile statement?
 
How about:
Code:
Set Myfile = fso.GetFile(objArgs(I))
?

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Wow. Thanks. I probably tried every other combination of () & "" etc. Just too easy I guess.

Thanks again.

 



TS,

Don't forget to
[blue]
Thank Tek-Tip Contributor
for this valuable post!
[/blue].

The [purple]little purple Stars[/purple] accomplish several important things.

First, it gives positive feedback to contributors, that their posts have been helpful.

Second, it identifies threads as containing helpful posts, so that other members can benefit.

And third, it identifies the original poster (that's YOU, BTW), as a grateful member, that not only receives, but is willing to give tokens of thanks.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top