Categories
Technology

Hello DOS! Taking a file to go on a windows machine

I have to copy over a file from the corporate network to my windows laptop on a regular basis. Being in the field, I don’t have a network connection very often. Hence, I opted against a scheduled task and went with a good old .bat file instead. This file sits on my desktop and everytime I log on to the network via VPN I click on that batch file. To keep a history of the files I wanted the current date in the file name. Here it goes:

@echo off
SET DAY=%DATE:~0,2%
SET MONTH=%DATE:~3,2%
SET YEAR=%DATE:~6,4%
SET MYDATE=%YEAR%-%MONTH%-%DAY%
cd “C:\Documents and Settings\USER\My Documents\”

copy “F:\SRCDIRECTORY\FILENAME.EXT” “%MYDATE% NEW FILENAME.EXT” /Y

You would have to replace USER, SRCDIRECTORY, FILENAME.EXT, and NEW FILENAME.EXT with the respective values for your needs. How would you have solved that? Feel free to leave me a comment.

 

One reply on “Hello DOS! Taking a file to go on a windows machine”

In truth this is a fantastic indepth article even so as with all great copy writers there are many points that may be labored on. But by no means your much less it was interesting.

Comments are closed.