ScoobyNet.com - Subaru Enthusiast Forum

ScoobyNet.com - Subaru Enthusiast Forum (https://www.scoobynet.com/)
-   Computer & Technology Related (https://www.scoobynet.com/computer-and-technology-related-34/)
-   -   writing a batch file to check the date (https://www.scoobynet.com/computer-and-technology-related-34/232381-writing-a-batch-file-to-check-the-date.html)

DazV 22 July 2003 12:40 PM

haven't touched batch files in a long while, but knowing there's some server admins on here I was wondering if you could tell me if its possible to:

check todays date
if its a monday, copy folder x to destination z:/monday
if its tuesday, copy folder x to detination z:/tuesday
etc...

Thanks in advance

PS: OS = Win2k server

nigelward 22 July 2003 01:02 PM

A possible solution:

FOR /F "tokens=1" %i in ('DATE /T') do set today=%i

IF NOT "%today"=="Mon" GOTO next
copy x to y:\monday
GOTO the_end

:next
IF NOT "%today"=="Tue" GOTO next
copy x to y:\tuesday
GOTO the_end

..and so on.

paula_k 22 July 2003 02:04 PM

Hi, thanks for that. I couldn't get your code to work so I had a look at the FOR command and made the following changes...

FOR /F "tokens=1" %%i in ('DATE /T') do set today=%%i

IF NOT "%today%"=="Mon" GOTO tuesday
copy "file.txt" monday
GOTO the_end

:tuesday
IF NOT "%today%"=="Tue" GOTO wednesday
copy "file.txt" tuesday
GOTO the_end

:wednesday

:the_end


thnaks mate,
-DV


paula_k 22 July 2003 02:36 PM

is it possible to incorporate winzip into batch commands ?

I need to compress some files before moving them to a destination folder

JackClark 22 July 2003 02:41 PM

PKZip has a command line interface.

[Edited by JackClark - 7/22/2003 2:42:23 PM]

paula_k 22 July 2003 03:23 PM

cheers jack

DJ Dunk 22 July 2003 04:25 PM

DazV = paula_k ?

Forgot to change back after the weekend Daz ? ;)

rik1471 22 July 2003 05:07 PM

B U S T E D !

DazV 22 July 2003 08:51 PM

its a fair cop, I masquerade as a woman by day

by night, a sexually deviant necrophiliac with a penchant for beastiality

...or am I just flogging a dead horse ?


rik1471 22 July 2003 09:04 PM

lol :D

DazV 22 July 2003 10:30 PM

anyone know if its possible to use command lines to control a cd rewriter ?

eg.
xcopy to d: (where d: is the rewriter) ?


nigelward 23 July 2003 08:13 AM


Hi, thanks for that. I couldn't get your code to work so I had a look at the FOR command and made the following changes...
Oops, guess there must be some differences in the FOR command on NT4 and W2K, glad you worked it out.

Can't believe I missed the terminating % on the today environment variable as well.

Sheila ;)

rik1471 23 July 2003 08:33 AM

http://rikwakefield.com/software/createcd.zip

CreateCD [options] <FILESPEC>[<FILESPEC>]...

options - one or more of the following:

-e[rase] - Erase disk before writing
-f[ullerase] - Erase disk and quit. This is 'full" erase that takes quite some time
-nologo - Do not display logo string
-r[ecorder]:<LETTER> - Use recorder <LETTER>
-s[peed]:<NUMBER> - Use recording speed <NUMBER>
-v[erbose] - Produce more output
-info - Print recorder/disk information and exit
-eject - Eject disk after writing
-l[abel]:<VOLUME label> - Set volume label. Default is today's date
-i[mage]:<FILESPEC> - Make disk bootable using image <FILESPEC>. <FILESPEC>should be an image of a bootable floppy

Example: CreateCD -r:e -i:bootflpW98.img C:\Data\*.*

Rik :)

DazV 23 July 2003 05:08 PM

cool


All times are GMT +1. The time now is 06:58 AM.


© 2024 MH Sub I, LLC dba Internet Brands