[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Scheduling Task(running .bat file) on Windows 2000

Posted on 2002-07-18
1
Medium Priority
?
266 Views
Last Modified: 2012-05-04
Hi,
    I have a question regarding scheduling Task in a windows 2000 environment.
I have a .bat file wich does Oracle DB export to a .dmp file.
I want to task such that that batch file is run every 6 hours. This .bat file outputs as .dmp, say export.dmp
I want to schedule that in such a way that the exported file was post-fixed with some datetime in order to avoid from overwriting the .dmp file everytime it is run. How do I do that?
Thanks,
Kishore
0
Comment
Question by:kingno1
1 Comment
 
LVL 63

Accepted Solution

by:
SysExpert earned 400 total points
ID: 7162976
The easiest way is to rename the old file based beforehand, or rename the new file immediately after the export.

You can use the following as a template to get hold of the date-time info.
Use the tempdir to be part of the filename in the
ren command.

-----------

From: czpczp    Date: 06/25/2001 12:59PM PST Time date in batch file name directory by date
     The following script does *exactly* what you're looking for.  It will use the Time command
   (not time/t 'cause it doesn't give the seconds which is what you want), and parses the output string
 to extract the time in reverse order SEC:MIN:HR *extracting* the semi-colons.  THEN, it creates a directory
     *including* the client's name.  I did extensively test the script using varying times without having
      any problems.


     Cut and paste (verbatim) the script below into file with a BAT extension.  The following creates the
       directory on the root of the current drive (last line) -- you can alter where the directory is created
        depending on your needs (i.e. Md F:\LOG\%UserName%_%DirTemp%).

 Rem  ~~~ MakeDir.Bat ~~~~~~~~~~~~~~~~~~~~~~~~~~~

                 @echo off
                 cls

                 REM ** the following line gets the current time into a variable
                 echo.|time >holdstr

     REM ** The following 5 For statements parse the holdstr var to extract the time in reverser order
                 for /f "eol=E tokens=1,2,3*" %%a IN (holdstr) do echo %%a%%b%%c%%d  >holdstr
                 for /f "tokens=1,2* delims= " %%a IN (holdstr) do echo %%b  >holdstr
                 for /f "tokens=1,2* delims=." %%a IN (holdstr) do echo %%a  >holdstr
                 for /f "tokens=1,2,3 delims=:" %%a IN (holdstr) do echo %%c%%b%%a  >holdstr
                 for /f "tokens=1,2* delims= " %%a IN (holdstr) do set DirTemp=%%a%%b

                 REM ** remove temp file
                 del holdstr

                 Md \%UserName%_%DirTemp%

      Rem  ~~~~~~~~~MakeDir.bat

I hope this helps !

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Integration Management Part 2
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question