Ahappy Logo 2003 ahappy.com Home Dogs WebMail Grumbles Miscellaneous Links
        You are Here  

Computer stuff I don't want to have to find again when I forget how.

 

 

Copy a file to a printer

1. If it is a network printer map a drive to the printer (e.g. net use LPT2 \\server\printer)

2. The command is:

        copy c:\file.prn lpt1 /b

Batch Commands

Loop

This is a nice simple loop batch file I wrote  to run a command as many times as needed

set x=1
:home
set /A x=%x%+1
if %x%==5 goto end        'set the number of loops where this 5 is
echo what ever command you want to place here
goto home
:end

AUTO FTP

Use this to automatically download something from ftp.  You can schedule this to be run at set times using the AT command in NT or Scheduled Task.

There are two parts, the batch file which is used to start the ftp session, switch directories, or whatever you want done with the downloaded files.

Also there is the text file, that is called by the batch file and has the FTP commands.


Batch Files

    cd directory                         'change into the local directory to recieve the files
    start /w ftp -s:ftp.txt              'starts the ftp program (see ftp.txt)
    cls                                        'Make sure the cls command is that the very end of the batch file so it will close the DOS window

    Auto FTP

    open ftp.ahappy.com            'opens the ftp site
    anonymous                           'username
    user@somecompany.com     'password
    cd pub                                  'changes the directory on the ftp site
    binary                                   'changes the download type to binary
    prompt                                  'eliminates required responses from the FTP server
    get file1                                 'used to get the file.  You can also use mget for all files in a directory, or put and mput to upload
    get file2
    quit                                        'quits the ftp session and returns to the batch file