![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | new name of copied file hello, I am new here and a beginner in vbscript. perhaps you can help me? I have made the following script and its ok: Sub test Dim fso, MyFile Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile "c:\bild.gif", "d:\" End Sub But what I have to do, if I want to give a new name to the copied file? For example, the new filename should not be "bild.gif", but "newbild.gif"... Thankyou for help Norbert |
My System Specs![]() |
| | #2 (permalink) |
| | Re: new name of copied file On Sep 8, 10:38*am, "Norbert Römer" <nroe...@xxxxxx> wrote: Quote: > hello, > I am new here and a beginner in vbscript. perhaps you can help me? > I have made the following script and its ok: > > Sub test > Dim fso, MyFile > Set fso = CreateObject("Scripting.FileSystemObject") > fso.CopyFile "c:\bild.gif", "d:\" > End Sub > > But what I have to do, if I want to give a new name to the copied file? > For example, the new filename should not be "bild.gif", but "newbild.gif".... > > Thankyou for help > Norbert fso.CopyFile "c:\bild.gif", "d:\newbild.gif" My reading of the WSH documents indicates that works or is there more to your question than I see here? Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
My System Specs![]() |
| | #3 (permalink) |
| | Re: new name of copied file OK, it works, many thanks. But the specific problem ist, that I have to use a variable term, not "d:\newbild.gif". If I write set variable= "d:\newbild.gif" fso.CopyFile "c:\bild.gif", variable the I get errors. thanks Norbert "Tom Lavedas" <tglbatch@xxxxxx> schrieb im Newsbeitrag news:7430803a-b876-4772-ab84-0a604ef34d4b@xxxxxx On Sep 8, 10:38 am, "Norbert Römer" <nroe...@xxxxxx> wrote: Quote: > hello, > I am new here and a beginner in vbscript. perhaps you can help me? > I have made the following script and its ok: > > Sub test > Dim fso, MyFile > Set fso = CreateObject("Scripting.FileSystemObject") > fso.CopyFile "c:\bild.gif", "d:\" > End Sub > > But what I have to do, if I want to give a new name to the copied file? > For example, the new filename should not be "bild.gif", but > "newbild.gif"... > > Thankyou for help > Norbert fso.CopyFile "c:\bild.gif", "d:\newbild.gif" My reading of the WSH documents indicates that works or is there more to your question than I see here? Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
My System Specs![]() |
| | #4 (permalink) |
| | Re: new name of copied file Don't use the "Set" keyword when assigning values to string variables. It's used only for assigning object references. Does it work if you use? variable = "d:\newbild.gif" -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- "Norbert Römer" <nroemer@xxxxxx> wrote in message news:48c6513c$0$18729$9b4e6d93@xxxxxx-online.net... Quote: > OK, it works, > many thanks. But the specific problem ist, that I have to use a variable > term, not "d:\newbild.gif". If I write > > set variable= "d:\newbild.gif" > fso.CopyFile "c:\bild.gif", variable > > the I get errors. > > thanks > Norbert > > > "Tom Lavedas" <tglbatch@xxxxxx> schrieb im Newsbeitrag > news:7430803a-b876-4772-ab84-0a604ef34d4b@xxxxxx > On Sep 8, 10:38 am, "Norbert Römer" <nroe...@xxxxxx> wrote: Quote: >> hello, >> I am new here and a beginner in vbscript. perhaps you can help me? >> I have made the following script and its ok: >> >> Sub test >> Dim fso, MyFile >> Set fso = CreateObject("Scripting.FileSystemObject") >> fso.CopyFile "c:\bild.gif", "d:\" >> End Sub >> >> But what I have to do, if I want to give a new name to the copied file? >> For example, the new filename should not be "bild.gif", but >> "newbild.gif"... >> >> Thankyou for help >> Norbert > Have you tried ... > > fso.CopyFile "c:\bild.gif", "d:\newbild.gif" > > My reading of the WSH documents indicates that works or is there more > to your question than I see here? > > Tom Lavedas > =========== > http://members.cox.net/tglbatch/wsh/ > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Monitor a file, generate log when it was copied | VB Script | |||
| Copied file has System and Hidden attribute set. | .NET General | |||
| file has properties that cannot be copied | Vista General | |||
| Drops Network when large file copied to PC | Vista General | |||
| File Manager doesn't display WHAT file is being copied/moved!?!?!?! | Vista file management | |||