Home / Microsoft / Microsoft DOS / i need a information about DOS batch script
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: i need a information about DOS batch script  (Read 507 times)
renalte16
Topic Starter
Newbie



Posts: 1


« 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 ? 
IP logged
Helpmeh
Egghead



Thanked: 116
Posts: 3,583

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #1 on: November 07, 2009, 07:15:24 AM »

Look at

at /?
And that should help you. Please note that the computer must be on and logged in for programs to run automatically.
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
billrich
Guest
« Reply #2 on: November 07, 2009, 11:49:54 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    <DIR>          .
11/07/2009  12:52 PM    <DIR>          ..
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    <DIR>          .
11/07/2009  12:54 PM    <DIR>          ..
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>
IP logged
billrich
Guest
« Reply #3 on: November 07, 2009, 12:02:59 PM »

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.">>

IP logged
billrich
Guest
« Reply #4 on: November 07, 2009, 12:28:26 PM »


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    <DIR>          .
11/07/2009  01:40 PM    <DIR>          ..
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>
« Last Edit: November 07, 2009, 12:47:27 PM by billrich » IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / i need a information about DOS batch script « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.093 seconds with 20 queries.