Jump to content
xisto Community
RGF

Batch Files Tutorial

Recommended Posts

I wouldn't call batch files a programming language, but just command files working in console.. why not a programming language? because of mathematics it is able to do, it only recognizes simple numbers like 1,2,3,4.. [-9999999999;+999999999]; And the tools which can compile your bat file to exe is quite ridiculous, usually the compiled version takes 10 times more space than source :P but thats kind of quite normal.Say REXX is a more advanced command file scripting, which is capable of much more.. so I could call it (REXX) a scripting language..

Edited by Quatrux (see edit history)

Share this post


Link to post
Share on other sites

I love this, I often need to end about 5 processes, delete one or two folders, and start three programs.1. In one folder I want to delete, one of the files is now obsolete, but Windows still loves it. Can I avoid it or delete it through batch files?2. How do I end a process in these?

Share this post


Link to post
Share on other sites

Batch files were great. I remember when I was younger I used to try and teach myself how they worked by editing them/making my own. Typically they are now used for installers, etc. Most virus scanners DO however pick up non-system batch files, as they can be programmed for malicious purposes.I remember my friend didn't want his younger brother on his computer, so he made a batch file that shut down the computer when executed. Lets just say he put it in his brother's startup folder and his brother was pretty pissed.They can, however, be used to complete simple everyday tasks without extensive programming knowledge.

Edited by Kardus (see edit history)

Share this post


Link to post
Share on other sites

Problem

Batch Files

 

Trying to add this into a batch file I am working on, but it is not really working for me, it just closes out the second it comes in..Any help?

 

@echo off

Echo test

Pause >nul

Echo

 

===============================================================================

Echo � �============================================�

� � / / �

Echo � � | | | | �

� � | | | | �

Echo � � | | | | �

� � | | | | �

Echo � � / �

� � | O O | �

Echo � � | | �

� � | <__> | �

Echo � � | | �

� � _______/________________ �

Echo � � | �

� � �

Echo � � ________ �

� � / | �

Echo � � / ________|******* �

� � ___ __/ / |******** �

Echo � � | / |********* �

� � | / |******** �

Echo � � |______________/___________|******* �

�

Echo � �=========================================�

 

 

============================================================================�

 

Pause >nul

 

 

 

-Scott

Share this post


Link to post
Share on other sites

Opening Multiple Files simultaneously from batch file

Batch Files

 

I would like to open multiple files from a batch file.My code is

 

Call file x

Call file y

And so on

 

But the files open one by one and not until I close the first file the second does not open. Kindly advise

 

-question by saif

Share this post


Link to post
Share on other sites
I want to create a batch file the creates a Folder called= Themes & MODSBatch FilesI am trying to create a batch file to copy loads of files to a specific Folder that will be named

Themes & MODS 

When I run the batch file it does not seem to recognize the Syntax> Themes & MODS and says an error trying to create the file?

The structure I'm using is very simple PLEASE SEE BELOW...

:BEGIN@ECHO OFFECHO. **************************************ECHO. **   PSPWillys PSP Custom waves 2009 *   ECHO. ** For XMBeditor v2 Running CFW 3.90m33-2   *   ECHO. **************************************ECHO.ECHO.ECHO.ECHO.ECHO.Md F:Themes&ModsModssystem_plugin_bgMd F:Themes&ModsModssystem_plugin_bgAllsortCopy AllsortPreview.Jpg F:Themes&modsmodssystem_plugin_bgAllsort

This is just a sample of the batch code I'm writing...Is the problem with the "&" syntax?

If it is can someone point me in the right direction

ChrisUK

Share this post


Link to post
Share on other sites

The & is telling the command line parser that a new command is beginning. Thus your sytax is not going to work. The easiest solution would be to rename rhw offending folder to something friendlier to the batch file syntax.

Share this post


Link to post
Share on other sites
Creating User Defined Folders using DOSBatch Files

Hi there,

 

I was wondering if anyone had any code for a user to run a bat file and then have to enter a folder name to be created.

 I have seen several peices of code but nothing really stood out to me, I am a novice in DOS.

Any Help would be fantastic

Thank you

andrew

 

Share this post


Link to post
Share on other sites
Opening Multiple Files simultaneously from batch fileBatch Files

This was mentioned earlier, but not explained. If you execute another application from a batch file it will halt since it then waits for input from this application. To just start it and move on use the prefix "start".

-reply by iGuests little helper

 

Share this post


Link to post
Share on other sites
Anser feedbackerBatch Files

hey,

there are two ways to fix your problem:

1.) Add anouther line to the script  and type "pause" without the air quotes.

2.) Copy the BAT script to C:WINDOWSsystem32 , hit start , hit run , type cmd and hit enter , then enter the name of your BAT (e.G. Something.Bat) then it should run properly but it will still flash away if you don't start it in cmd.

that should help./txtmngr/images/smileys/smiley12.Gif

-reply by Nick O'Neill

Share this post


Link to post
Share on other sites
NEED HELP (.vbs or .bat ) gettingBatch Files

Set WTS = Wscript.CreateObject("WTSManager.Shell")Ip = WTS.MyIPAddressMsgbox ip

I will get ip from vbs file

 

echo offNet use v: /deleteNet use v: %clientname%.Domain.Comc$ /User:%clientname%administrator password@pass

need to change

net use v: ipc$ /User:%clientname%administrator password@pass

if NOT %errorlevel% ==0 goto :errC:Cd c:program filesStellentIBPMIBPM.ExeExit

:errEcho %errorlevel%Echo Error Occured Logging in to OptikaPause 

-reply by Abdul

Share this post


Link to post
Share on other sites
Open 3 command prompts and 2 folder locations in a batch fileBatch Files

Hi,

I want to open 3 command prompts those will be pointing to

cmd1 should point to 'C:Tomcat'Cmd2 should point to 'C:Tomcatlib'Cmd3 should point to 'D:Test'

Also I need to open 2 folder locations(2 different windows simultaneously)1) C:Program Files2) D:Lab

How can I do these all in a single bat file? I need to open the above listed windows in a single click

Share this post


Link to post
Share on other sites

Here are 2 files that I JUST made for you.

The 1st is a program that asks for a folder name to make, and will make it in the directory specified within the batch file.  I highlighted it so you can change the path. Make sure to change them ALL to the SAME EXACT PATH.

 

@echo offTitle .::FOLDER CREATOR by Dan Wager::.Color A:topClsEcho Folder name to be created?Set /p folder=""If exist C:[/font]"%folder%" goto alreadyExistClsEcho Make folder "%folder%" in C:[/font]?Set /p choice=""If "%choice%"=="y" goto execute  ::"y" or ENTER will Execute commandIf "%choice%"=="" goto executeIf "%choice%"=="and" goto top   ::"and" will NOT execute commandGoto top:executeMd c:[/font]"%folder%"If exist C:[/font]"%folder%" goto againClsEcho Folder Creation Failed...Echo Try Again?Set /p bad=If "%bad%"=="y" goto top  ::anything other than "y" or ENTER will exitIf "%bad%"=="" goto topClsEcho Press ENTER to ExitPause >nulExit:againClsEcho Folder Created SuccessfullyEcho Make Another Folder?Set /p another=If "%another%"=="y" goto top  ::anything other than "y" or ENTER will exitIf "%another%"=="" goto topClsEcho Press ENTER to ExitPause >nulExit:alreadyExistClsEcho Folder Already ExistsEcho Press ENTER to Choose a Different NamePause >nulGoto top

_________________________________________________________

The second is a program that asks for both the folder name and path that you want to make.  When entering the path name, do NOT put a back slash at the end of the path () or else it wont work.

 

@echo offTitle .::FOLDER CREATOR by Dan Wager::.Color A:topClsEcho Folder name to be created?Set /p folder=""ClsEcho Where Do You Want The Folder Created?Echo example:  C:Documents and SettingsAll UsersSet /p location=""If exist "%location%""%folder%" goto alreadyExistClsEcho Make folder "%folder%" in %location%?Set /p choice=""If "%choice%"=="y" goto execute  ::"y" or ENTER will Execute commandIf "%choice%"=="" goto executeIf "%choice%"=="and" goto top   ::"and" will NOT execute commandGoto top:executeMd "%location%""%folder%"If exist "%location%""%folder%" goto againClsEcho Folder Creation Failed...Echo Try Again?Set /p bad=If "%bad%"=="y" goto top  ::anything other than "y" or ENTER will exitIf "%bad%"=="" goto topClsEcho Press ENTER to ExitPause >nulExit:againClsEcho Folder Created SuccessfullyEcho Make Another Folder?Set /p another=If "%another%"=="y" goto top  ::anything other than "y" or ENTER will exitIf "%another%"=="" goto topClsEcho Press ENTER to ExitPause >nulExit :alreadyExistClsEcho Folder Already ExistsEcho Press ENTER to Choose AgainPause >nulGoto top

 

HOPE THIS HELPS!!

 

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

×
×
  • 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.