Jump to content
xisto Community
Sign in to follow this  
psychologist

Required Dos Programing how to write code for dos - like *.bat

Recommended Posts

All the information you'll need is in the help dialogs, just type "help" at the command prompt and it'll list all the commands available. Then just type a command followed by /? and it'll show all the help for that command:
C:\current_directory>echo /?

For what you described above, you may want to look at "set", "if", "echo", "goto" for starters.

A few tips:

type "set" to display a list of all system variables (DATE is a sytem variable!)use the "@" sign to turn echo off for the current line onlyyou can use "%n" to pass variables into the batch file (ex: typing "mybat.bat blah crap", then in your bat file you can sayif "%1"=="blah" start blah.exeif "%2"=="crap" goto craphere's a little code to get you started:CODE@ECHO offCLSECHO:This is my batch fileREM enter comments hereIF /i "%1"=="skip" ( ECHO:You must not care what day it is GOTO endofprogram)SET dayofweek=%date:~0,3%IF "%dayofweek%"=="Fri" (  ECHO:It's Friday!!) ELSE (  ECHO:Nope, not friday yet):endofprogramECHO:ECHO:PAUSE


I'm sure there are some good tutorials out there, but this will at least get you started

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.