Computer Hope

Computer Hope Forum Welcome, Guest. Please login or register.
November 22, 2009, 11:37:20 AM
Home Help Staff Chat Login Register
News: Come introduce yourself and meet the other forum members.

Computer Hope Forums  >>  Microsoft  >>  Microsoft DOS (Moderator: Computer Hope Admin)  >>  Topic: 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 182 times)
renalte16
Topic Starter
Newbie
*
Posts: 1

Thanked: 0
OS: Windows XP
Experience: Beginner


« 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:
@ echo off
   mkdir mydirectry
   so how to make it run automatically ? 
Logged
Helpmeh
Expert
*
Posts: 2186

Thanked: 61
OS: Windows XP
Experience: Familiar



Can you see this as it truly is? >< Tell me.


« 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.
Logged


>< If you have this, you can see it. ><
I love 
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:
@ echo off
   mkdir mydirectry
   so how to make it run automatically ? 


C:\batextra>type runwithat.bat
Code:
@ 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>
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.">>

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 » Logged
Pages: [1] - (Top) Print 
Computer Hope Forums  >>  Microsoft  >>  Microsoft DOS (Moderator: Computer Hope Admin)  >>  Topic: i need a information about DOS batch script « previous next »
Jump to:  


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright 1998-2008 by Computer Hope (tm). All rights reserved
Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC
Page created in 0.098 seconds with 18 queries.