1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

VBS Help (Very Very Basic)

Discussion in 'Networking' started by Sealclubber, Oct 21, 2005.

Thread Status:
Not open for further replies.
Advertisement
  1. Sealclubber

    Sealclubber Thread Starter

    Joined:
    Jul 5, 2002
    Messages:
    205
    Hey guys, i've been looking for a way of making a .vbs script that moves a file from one location to another, but alas no luck. Maybe i did run accross a way of doing it, but i never recognized it.

    Right now i have a .bat file that copys
    \\kec-server\hosts\hosts to C:\windows\system32\drivers\etc\

    but when i go to log off, i get a pop-up prompt that asks to end task of cmd.exe

    i figured its still running the script...

    anywho, if you can help me, either by telling me how to get rid of the pop-up prompt, or how to move files via .vbs scripting i'd greatly appreteate it.
     
  2. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    Use the FileSystemObject.CopyFile method in VBScript.
     
  3. Sealclubber

    Sealclubber Thread Starter

    Joined:
    Jul 5, 2002
    Messages:
    205
    I found a few websites telling me how to use it, but i'm still at a loss. I've put the this into a .vbs script trying to get it to run, but it won't:

    FileSystemObject.CopyFile "\\kec-server\hosts\hosts", "C:\windows\system32\drivers\etc\"[, overwrite]




    If anyone could help me, i'd really appreteate it.. i'm so lost in .vbs scripting all i can say is i know VB stands for visual basic...

    help would be greatly appreteated as this is my last day on this job...

    [edit] I downloaded a program called "Script-o-Matic", but i can't find FileSystemObject.CopyFile in it, God obviously doesn't want me to get this working :( [/edit]
     
  4. Mithrilhall

    Mithrilhall

    Joined:
    Mar 28, 2001
    Messages:
    781
    Something like this?

    Code:
    dim filesys, demofile
    set filesys = CreateObject ("Scripting.FileSystemObject")
    set demofile = filesys.CreateTextFile ("c:\somefile.txt", true)
    set demofile = filesys.GetFile("c:\somefile.txt")
    demofile.Copy("c:\projects\someotherfile.txt")
    
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/409928

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice