|
|
Subject:
Need a simple batch file for Win2K
Category: Computers > Programming Asked by: turk44-ga List Price: $5.00 |
Posted:
14 Jul 2004 12:58 PDT
Expires: 13 Aug 2004 12:58 PDT Question ID: 374083 |
I need a simple batch file for Win2K: 1. Placed in the Shutdown folder, it would create a text file that is a list of all files created on the date that the batch file is run (i.e. the date the system was shut down). 2. The resulting text file would be given a unique name including the date the text file was created (to prevent overwriting by subsequent files). |
|
There is no answer at this time. |
|
Subject:
Re: Need a simple batch file for Win2K
From: crythias-ga on 14 Jul 2004 16:53 PDT |
Will it matter that this could possibly add several minutes to the shutdown time? Also, there isn't such a thing as a shutdown folder, as I understand it. There is shareware that can provide such... http://www.hs-lab.com/Products/df/ Here's a batch that will do it and shutdown... You'll need a free utility QSD to shutdown 2000 ... http://www.winutility.com/qsd/ BTW: I completely plagiarized all but the last two lines from http://www.robvanderwoude.com/files/datetime.txt @ECHO OFF :: DateTime.bat :: Set environment variables with current Date, Time and DayOfWeek :: Recursion IF NOT "%3"=="" GOTO SecondTime :: Create temporary batch file > TEMPDTT1.BAT ECHO @PROMPT %0 $D $T :: Do _N_O_T_ replace "COMMAND /C" with CALL in the next line > TEMPDTT2.BAT COMMAND /C TEMPDTT1.BAT TEMPDTT2 :SecondTime DEL TEMPDTT?.BAT SET DOW=%1 SET DATE=%2 SET TIME=%3 :: Remove forward slashes from DATE variable and store result in DATE2 IF EXIST DATE2.BAT DEL DATE2.BAT SET DATE2= :: Parse DATE variable and create temporary batch :: file to recreate DATE without forward slashes >> DATE2.BAT FOR %%A IN (/%DATE%) DO ECHO SET DATE2=%%DATE2%%%%A CALL DATE2.BAT DEL DATE2.BAT dir /4 /s c:\ | find "%DATE%" > c:\%date%.txt qsd -s |
Subject:
Re: Need a simple batch file for Win2K
From: turk44-ga on 14 Jul 2004 18:07 PDT |
Since the system turns itself off, the added time is not a problem. When I left-click Start, there is a second "Shutdown" option just above a line that divides this menu into two parts. If I right click on this "Shutdown", a folder opens. Any program in this folder runs when the other "Shutdown" option is selected. I think this is native to 2000 - I found this in an article in PCWorld. (That'll be $5.) Thanks for your quick response. I'll try the batch file tomorrow. |
Subject:
Re: Need a simple batch file for Win2K
From: turk44-ga on 14 Jul 2004 22:35 PDT |
Addendum to my comment in response to crythias-ga: My W2K system at home does NOT have the shutdown folder I described; what I described was my work system, a new Dell (with W2K) that our system guy just set up for me recently. I don't know if this reflects a difference in builds (I don't know how to check for this), or maybe he customized things for me. I'm intrigued by the fact that QSD was apparently necessary. I wrote a one-line batch file: dir /s | find 07/10/2004 > 07102004.txt and put it in my Shutdown folder. At the end of the day, I clicked Start:Shutdown and walked away. The next morning my system was powered down and 07102004.txt had been created. So what is QSD for? |
Subject:
Re: Need a simple batch file for Win2K
From: crythias-ga on 15 Jul 2004 06:33 PDT |
OK, I'll paste that information here so I can find it in the future: http://www.pcworld.com/howto/article/0,aid,115628,00.asp First, create your shutdown folder. Note that launching items from a folder at shutdown works only with Windows 2000 and XP, so Windows 9x and Me users can skip this step and follow the instructions below for running programs at shutdown. To keep your shutdown folder with your Startup folder, right-click the Start button and click Open. Double-click Programs and then select File, New, Folder. Type Shutdown and press Enter to give the folder a name. Press Enter again to open the folder, and then fill it with shortcuts to any programs you want to run at shutdown: Use the right-mouse button to drag an item from any menu or folder window to your Shutdown folder and choose Create Shortcut(s) Here (in XP) or Copy Here (in 2000). -=-=- End quote -=-=- Though not *native*, I see the ability. OK, No, you don't need qsd. |
Subject:
Re: Need a simple batch file for Win2K
From: crythias-ga on 15 Jul 2004 06:38 PDT |
Hold on, let me revise that... You do need QSD or another utility to shutdown Windows. http://www.pcworld.com/howto/article/0,aid,113459,00.asp |
Subject:
Re: Need a simple batch file for Win2K
From: turk44-ga on 15 Jul 2004 07:39 PDT |
Thanks for digging up the PCWorld article and jogging my memory on how the Shutdown folder got there (I did it!). I just put the batch file you sent in my Shutdown folder, then did a normal Start;Shutdown. The system turned itself off, and it did seem to take a bit longer than normal. Anyway, when I rebooted, the two temporary batch files had been created in the Shutdown folder, but no 07152004.txt file. I searched the hard drive just to make sure it wasn't there. (BTW, I did not include the last line of your batch file ("qsd -s"). Since the system shut down OK, this would seem to say you were right the first time, when you said qsd is not needed.) |
Subject:
Re: Need a simple batch file for Win2K
From: crythias-ga on 15 Jul 2004 10:22 PDT |
OK, :) I ran it OK on Windows 98, but Win2K uses slashes for dates. Whew, this is a bugger. Here's my code... You'll have to guess about directory structure, however... @ECHO OFF :: DateTime.bat :: Set environment variables with current Date, Time and DayOfWeek :: Recursion IF NOT "%3"=="" GOTO SecondTime :: Create temporary batch file > TEMPDTT1.BAT ECHO @PROMPT %0 $D $T :: Do _N_O_T_ replace "COMMAND /C" with CALL in the next line > TEMPDTT2.BAT Command /E:2048 /C TEMPDTT1.BAT TEMPDTT2 :SecondTime DEL TEMPDTT?.BAT SET DOW=%1 SET DATE=%2 SET TIME=%3 echo %date% > date1.txt for /F "tokens=1,2,3 delims=/" %%j in (date1.txt) DO set DATE2=%%j%%k%%l del date1.txt dir /s c:\ | FIND "%DATE%" > C:\%DATE2%.TXT |
Subject:
Re: Need a simple batch file for Win2K
From: crythias-ga on 15 Jul 2004 10:38 PDT |
it fails. I know it. The trailing space on the year for my code gives problems. if you remove %%l from the FOR line, it'll work, but you don't get a year in the filename. Probably won't matter too much for you, though. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |