1.

Solve : i need a information about DOS batch script?

Answer» hello evry one
i just want to know how to make a DOS BATCH script file (.bat) run automatically ?

for example a make this simple code : Code: [Select]@ echo off
mkdir mydirectry so how to make it run automatically ? Look at

at /?
And that should help you. Please note that the computer must be on and logged in for programs to run automatically. Quote from: renalte16 on November 07, 2009, 07:13:30 AM
hello evry one
i just want to know how to make a DOS batch script file (.bat) run automatically ?

for example a make this simple code : Code: [Select]@ echo off
mkdir mydirectry so how to make it run automatically ?


C:\batextra>type runwithat.bat
Code: [Select]@ echo off

cd \
cd mydirectory

del myfile.txt
cd \
rd mydirectory

mkdir mydirectory

cd c:\mydirectory

echo hello > myfile.txt

dir
(I will schedule runwithat.bat with "At" or scheduled tasks and post back.)

Output:


C:\batextra>runwithat.bat
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3

Directory of C:\mydirectory

11/07/2009 12:52 PM .
11/07/2009 12:52 PM ..
11/07/2009 12:52 PM 10 myfile.txt
1 File(s) 10 bytes
2 Dir(s) 304,406,917,120 bytes free
Press any key to continue . . .
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3

Directory of C:\mydirectory

11/07/2009 12:54 PM .
11/07/2009 12:54 PM ..
11/07/2009 12:54 PM 10 myfile.txt
1 File(s) 10 bytes
2 Dir(s) 304,406,917,120 bytes free

C:\mydirectory>Following information from XP Help and Support section:

<<<"To schedule a new task
Open Scheduled Tasks.
Double-click Add Scheduled Task.
Follow the instructions in the Scheduled Task Wizard.
Notes

To open Scheduled Tasks, click Start, click All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks.
If you want to configure advanced settings for the task, select the Open advanced properties for this task when I click FINISH check box on the final PAGE of the wizard.
Confirm that the system date and time on your computer are accurate, because Scheduled Tasks relies on this information to run scheduled tasks. To verify or change this information, double-click the time indicator on the taskbar.
If you leave the password blank and you want the task to run when you are logged on, open the task. On the Task tab, select the Run only if logged on check box. The task will run at its scheduled time when the user who created the task is logged on to the computer.">>


C:\batextra>at 13:40 "C:\batextra\runwithat.bat"
ADDED a new job with job ID = 1

C:\batextra>at
Status ID Day Time Command Line
-------------------------------------------------------------------------------
1 Today 1:40 PM C:\batextra\runwithat.bat

C:\batextra>type runwithat.bat
@ echo off

cd \
cd mydirectory


del myfile.txt
cd \
rd mydirectory

mkdir mydirectory

cd c:\mydirectory

echo hello > myfile.txt


C:\batextra>cd ..

C:\>cd mydirectory

C:\mydirectory>dir
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3

Directory of C:\mydirectory

11/07/2009 01:40 PM .
11/07/2009 01:40 PM ..
11/07/2009 01:40 PM 10 myfile.txt
1 File(s) 10 bytes
2 Dir(s) 304,405,028,864 bytes free

C:\mydirectory>


Discussion

No Comment Found