free log
CRM

Bozteck VNCScan Community

Community makes things happen
Welcome to Bozteck VNCScan Community Sign in | Join | Help
in
Home Forums

Learn to write script / Nedd a script to copy a file.

Last post 08-23-2007, 11:58 AM by AlanK. 1 replies.
Sort Posts: Previous Next
  •  08-14-2007, 7:03 AM 2058

    Learn to write script / Nedd a script to copy a file.

    My question is, where do I start to learn how to write scripts:

       where can I get a list of script commands.

    I only ask of course so I dont have to post evry thing I want to do here. Like:

    Copy a file from the server and past to the local machine! If any one has a good idea, here is what I am trying to do:

    Copy \\server\c\access.mdb

    Replace c:\access\access.mdb

    I tried writing a simple batch file of exactly the above, but it wont execute.

  •  08-23-2007, 11:58 AM 2070 in reply to 2058

    Re: Learn to write script / Nedd a script to copy a file.

    There are several types of scripting languages.  Of the ones that are available in Windows, if you're using Windows 95/98/ME you'll probably need to stick with simple DOS batch files.  NT has some extensions to the standard batch file, but it's basically the same.

    If you have Windows 2000 or later you can use VBScript or JScript.  There are lots of examples and tutorials at Microsoft: http://www.microsoft.com/technet/scriptcenter/default.mspx  VBScript and JScript are fairly easy to use, and much more powerful than batch files.  The best way to learn them is to read the tutorials and start reading some of the hundreds of scripts that Microsoft has at that site.

    There are also other scripting languages such as PowerShell, but they require additional programs to be installed.  The advantage is that they often offer more features than what is built into Windows, but also a longer learning curve.

    To keep things simple, Batch files are usually how most people get started.  Basically it's just a list of commands in a text file exactly how they would be typed at the Windows command line.  If you can type a command and have it work, then you can put it in a Batch file (.BAT or .CMD) and Windows will run it.  Microsoft doesn't have a whole lot of resources on batch files because they're kind of dated, but there are other websites that still support the format.  Use google and look for "batch files" or "DOS commands".  You can also open the Windows command prompt and type HELP.

    As for your specific example, those are not valid commands.  Go to DOS and type COPY /? for information on the copy command.  I've never used the REPLACE command, so I really don't know how, but the COPY command should be sufficient, but at the very least you need to specify where the file is to be copied to.  For example:

    copy \\server\c\access.mdb C:\access\access.mdb

    To keep it from asking you if you want to overwrite the file, add /y to the command.

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems