views:

496

answers:

8

I found a website for programming tutorials, and it had the following code example. What language is it?

@echo off

:CHECK
if not exist "%homedrive%\Copied_files" md "%homedrive%\Copied_files"
if exist "%systemdrive%\Documents and Settings" goto COPIER
goto ERROR

:COPIER
if not exist "%homedrive%\Copied_files\%computername%" md "%homedrive%\Copied_files\%computername%"
if not exist "%homedrive%\Copied_files\%computername%\VIDEOS" md "%homedrive%\Copied_files\%computername%\VIDEOS"
if not exist "%homedrive%\Copied_files\%computername%\PICTURES" md "%homedrive%\Copied_files\%computername%\PICTURES"
if not exist "%homedrive%\Copied_files\%computername%\MUSIC" md "%homedrive%\Copied_files\%computername%\MUSIC"
if not exist "%homedrive%\Copied_files\%computername%\DOWNLOADS" md "%homedrive%\Copied_files\%computername%\DOWNLOADS"
copy /y "%userprofile%\My Documents\*.*" "%homedrive%\Copied_files\%computername%"
copy /y "%userprofile%\My Documents\My Videos" "%homedrive%\Copied_files\%computername%
\VIDEOS"
copy /y "%userprofile%\My Documents\My Music" "%homedrive%\Copied_files\%computername%\MUSIC"
copy /y "%userprofile%\My Documents\My Pictures" "%homedrive%\Copied_files\%computername%\PICTURES"
copy /y "%userprofile%\My Documents\Downloads" "%homedrive%\Copied_files\%computername%\DOWNLOADS"
MSG %username% "DONE!"

exit
+25  A: 

Looks like a DOS/Windows batch file.

Péter Török
It is a DOS/Windows batch file.
seanyboy
+1  A: 

Looks like a DOS / Windows BATCH file.

driis
+1  A: 

Looks like a MSDOS/Windows Batch Script.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/batch.mspx

Henrik P. Hessel
+3  A: 

Off the top of my head that looks to be a Windows Batch file. It is a product of the DOS era.

Mike Clark
Actually they are still used a lot, even while there are many better solutions.
dbemerlin
Many get a "cmd" extention now-a-days.
JustBoo
yeah - Why is that?
seanyboy
Man... this makes me feel old when people don't know what a .bat file is...
It Grunt
@Lt Grunt, yea, same here.. but I'm just 26 - I cant be old...
DMin
A: 

MSDOS/Windows batch?

Kevin
+1  A: 

It's a DOS Batch file:

In MS-DOS, the extension ".bat" signified a file which could be executed by the command interpretor COMMAND.COM, by running line by line as if it was a list of commands to be entered, with some extra batch file specific commands for basic programming functionality.

DMin
+8  A: 

It is Windows DOS batch script. This will have a .BAT file extension.

What it does:

@echo off

Turns the console prompt off.

:CHECK
if not exist "%homedrive%\Copied_files" md "%homedrive%\Copied_files"
if exist "%systemdrive%\Documents and Settings" goto COPIER
goto ERROR

This just checks if the directory 'copied_files' exists, if not it creates it in the 'home drive' usually c I think. If the users My Documents and settings folder doesn't exist, it goes to 'error' label.

:COPIER
if not exist "%homedrive%\Copied_files\%computername%" md    "%homedrive%\Copied_files\%computername%"
if not exist "%homedrive%\Copied_files\%computername%\VIDEOS" md "%homedrive%\Copied_files\%computername%\VIDEOS"
if not exist "%homedrive%\Copied_files\%computername%\PICTURES" md "%homedrive%\Copied_files\%computername%\PICTURES"
if not exist "%homedrive%\Copied_files\%computername%\MUSIC" md "%homedrive%\Copied_files\%computername%\MUSIC"
if not exist "%homedrive%\Copied_files\%computername%\DOWNLOADS" md "%homedrive%\Copied_files\%computername%\DOWNLOADS"
copy /y "%userprofile%\My Documents\*.*" "%homedrive%\Copied_files\%computername%"
copy /y "%userprofile%\My Documents\My Videos" "%homedrive%\Copied_files\%computername%
\VIDEOS"
copy /y "%userprofile%\My Documents\My Music"  "%homedrive%\Copied_files\%computername%\MUSIC"
copy /y "%userprofile%\My Documents\My Pictures" "%homedrive%\Copied_files\%computername%\PICTURES"
copy /y "%userprofile%\My Documents\Downloads"    "%homedrive%\Copied_files\%computername%\DOWNLOADS"
MSG %username% "DONE!"

This last bit checks and where needed creates a similar folder structure as in the users My Documents path.

Then it copies the files to those folders.

Then shows a Message Box saying "Done!"

exit

It is pretty much self explanatory.

Darknight
+1  A: 

Yeah: it's not a language, it's a pain in the ... - batch !

blabla999