Talk:Batch file

message: Regarding:
* The commands may be built into the command processor (COPY), supplied with the operating system but not built into it (XCOPY invokes the Microsoft DOS program XCOPY.EXE), or may be any program (cp invokes the program cp.exe if present, an .EXE port of the Unix cp command, with essentially the same functionality as XCOPY.EXE).
Probably would be a bit clearer to those likely to look up this article imho if an Windows-centric example was provided along with minor other changes, i.e.
* The command may be an "internal command" built into the command processor (COPY, TYPE, SET), an "external command" supplied with the operating system but not built into it (e.g., XCOPY invokes the console program XCOPY.EXE), or may be any other program within any directory in the PATH environment variable (e.g., "winword" invokes Microsoft Word on Windows if installed).  — Preceding unsigned comment added by 69.247.27.45 (talk) 18:56, 24 November 2011 (UTC)
thread_title: Suggestion of better example of external, non OS-supplied command (cp.exe)

message: The "10 Useful Batch Commands, B.Arthur" link is slightly broken.
== Confusing "SET" command description
batch file
The following sentence under the "Uses" heading is very confusing.
"They are mainly used to use the "set" command, which sets a string to another, during the time the batch file is being processed."
Possibly the author meant:
*"Batch files can be used to set global environment variables."
**However, a "DOS" command shell in a modern Windows platforms runs in a virtual space, so simple "SET" commands cannot be used to modify global environment variables.
*"Batch files often use environment variables, which are string keys that map to string values."
**This is possibly useful information, but it should be in its own section and requires more than one sentence of explanation.
If the sentence is not replaced with something more informative, does anyone take issue with deleting it?
Johngiors 05:01, 22 February 2007 (UTC)
thread_title: 10 useful batch commands slightly broken

message: Link: Laura Fairhead's .BATs (chess!) 
URL: http://lf.8k.com/BAT/BAT.HTM
page bat.htm contains signature of the HTML scrpt virus"HTML/Dldr.Agen.QV.7
Not only that, I think that the examples of bad things that can be done is not such a good idea.  I think that talking about how to do loops and access executables that are installed with Windows using switches to perform specific functions is a great idea for examples and is one of the big reasons to make batch files but we don't have to show how to create havoc, unless maybe in a context of "watch out for infinite loops" or some link to bad programming techniques. (Dan Apr.12.2008)
:I agree. I'm going to take them out.  If anyone has a good justification for their existence, please note it here. akaDruid (talk) 10:52, 22 May 2008 (UTC)
thread_title:  External link on this page leads to site with Virus. 

message: IEXPRESS.EXE (included with windows xp) can be used to convert .bat to .exe according to: http://renegadetech.blogspot.com/2006/07/how-to-convert-bat-file-or-vbs-file.html L CuRtiS 21:23, 30 August 2007 (UTC)
thread_title:  IExpress.exe 

message: Videos on youtube (such as: My greatest batch file, or batch anti virus program) are harmless uneffective batch files that imitate or create a fake fictional security programs on a batch file.
I also made one myself but I can't place it on here because the preview page doesn't align the command-lines correctly.  —Preceding unsigned comment added by The guardians27 (talk • contribs) 21:44, 31 May 2008 (UTC)
thread_title:  Some people make batch files for fun that look like security programs 

message: I saw on some webpage that "%~d0" returns the drive where the batch file is, so a bat file containing the single line
 echo "%~d0"
would print  "C:\"  if the bat file were c:\foo\test.bat   and "F:\" if the bat file were f:\baz\test.bat (irregardless from which disk it's called, it returns the drive containing the bat file)
Now, I tried googling that, but there's about a gazillion of spurious results caused by "D0". Does anyone know a reference page where that trick is documented (and also other) ? -- m:drini  20:10, 2 August 2008 (UTC)
thread_title:  Cryptic variable on DOS batch file 

message: what is a good example of batch file and name a feature that identifies the example as being of the category  —Preceding unsigned comment added by 219.89.203.156 (talk) 22:11, 23 September 2008 (UTC)
thread_title:  batch files  

message: http://stackoverflow.com/questions/148968/dos-batch-files-bat-vs-cmd
—Preceding unsigned comment added by 150.101.166.15 (talk) 06:57, 6 November 2008 (UTC)
thread_title:  differences between bat and cmd on xp 

message: can it have a list of commands usable in batch files (excluding dangerous ones)?  —Preceding unsigned comment added by Superlinka (talk • contribs) 19:46, 21 December 2008 (UTC)
replies: text: I think it might be good to include a few examples of commands that are specific to batch files like GOTO and CALL.  I'll see if I can get a list together and put them in the form of an example and suggest the edit to here.  --Cribrad (talk) 08:44, 30 May 2009 (UTC)
thread_title:  syntax 

message: This article is a complete mess; too many examples, history section all messed up.  I'm gonna try and tidy it up, please post anything in regards to my changes here.  Veltas (talk) 13:52, 28 July 2010 (UTC)
thread_title:  Messy article 

message: The article is about batch files in Windows, DOS and OS/2, yet we have an extension listed for third-party software that may or may not be included with any of these systems.  I don't see the reason for this, if the BTM extension needs a home it belongs in a separate article.  Veltas (talk) 15:05, 28 July 2010 (UTC)
thread_title:  BTM Extension 

message: I've just reverted a poorly written refenece t this in the lead. See http://blogs.msdn.com/b/oldnewthing/archive/2005/03/08/389527.aspx for some interesting stuff about the issue - but imho this isn't enough of an issue to be in the intro, and probably not in the article at all because problems only occur with characters from 128 to 255 (so-called "extended characters") Snori (talk) 06:24, 6 November 2010 (UTC)
thread_title: Code page mismatch...

message: Is it acceptable for Wikipedia to act as a command reference for programming languages? I am not sure if that is permissible or not, since it would seem to fall under "Wikipedia is not a guide".
The exceptions section I started is mostly intended to cover notable limitations and weirdness in the programming language. The recent addition by User:Joey-das-WBF about the TIMEOUT command is especially valuable since that is apparently not documented clearly by Microsoft anywhere.
Googling for TIMEOUT, limiting to the microsoft.com site is particularly unhelpful: http://www.google.com/search?hl=en&client=firefox-a&hs=myF&rls=org.mozilla%3Aen-US%3Aofficial&q=%22timeout.exe%22+site%3Amicrosoft.com&aq=f&aqi=&aql=&oq=&gs_rfai=
It would seem worthwhile to make a summary section of what batch file commands are available in each edition of DOS / Windows.
I see TIMEOUT was an NT 4.0 resource kit command, yet it is a standard part of Windows 7. So when did it go from an add-on to standard equipment? Microsoft is not helpful, apparently, but a direct review of EXE's in NT 4 and Windows 2000, etc would show where the transition occurred.
DMahalko (talk) 14:58, 16 December 2010 (UTC)
replies: text: A how-to-use-batch-files article is really for a Wikibook, and not for the encyclopedia. How much how-to are we supposed to give in this article? --Wtshymanski (talk) 15:47, 19 January 2011 (UTC)
replies: text: I think this article in general is getting a bit big.  It could do with being pared down quite significantly - much of the stuff here is Google-fodder really.   a_man_alone (talk) 16:32, 19 January 2011 (UTC)
thread_title:  This article and WP:NOT ... is a command reference allowed? 

message: Code examples are great. But this page looks like you are making a BATCH tutorial for beginners. --Carrot Lord (talk) 15:56, 21 January 2013 (UTC)
thread_title:  Too much HowTo 

message: Batch files are used to execute the DOS commands and other executable files and/or windows applications.
;Batch file execution in VB 6.0
;=========================
It is very easy to execute the batch files or DOS commands or .exe files in visual basic 6.0
by using the 'Shell' built-in function.
For example, shutdown the system;
# Open a new batch file
# Type "shutdown -s -f" into the file
# Save the file in someone location (For example, "D:\shutdown.bat")
# Open a new Visual Basic Project
# Add a command button in VB form
# Goto code window and type the following
  Private Sub Command1_Click()
  Shell("D:\shutdown.bat")
  End Sub
Save the project ans run it.
For Restart; "shutdown -r -f"  For Logoff; "shutdown -l -f" 
This is a simple example. Definitely it is help for improving this article.
--Ananthakumar Selvaraj, SeA Microsystems 16:26, 6 March 2013 (UTC)
thread_title: Impact of Batch File

message: The "Early Windows" section starts: "Microsoft Windows was introduced in 1985 as a GUI Operating System alternative to text-based operating and was designed to run on MS-DOS." Wouldn't "GUI Operating Environment" be more accurate? The difference between early (Microsoft) Windows and current (Microsoft) Windows was that the early (Microsoft) Windows was a GUI overlay onto DOS. The later (Microsoft) Windows are full fledged Operating Systems.
JsunX (talk) 16:19, 19 March 2013 (UTC)
thread_title:  the "Early Windows" section 

message: I discovered a new limitation and exception recently. Although MSDOS generally uses backslashes for directory separators, many commands also accept forward slashes as directory separators. But the forward slash is also commonly used as a way to specify a command parameter.
Since file paths in Windows 95 and higher can contain spaces, it becomes a confused mess to try to determine if the command line path is intended to contain spaces, or if the spaces are delimiters between the path portion and the parameter portion. A forward-slashed parameter could be treated as a directory name if it exists in the path specified.
And although many default Windows NT CMD programs accept forward slashes in a directory path, the DIR command does not, unless they are escaped inside a quoted string. The DIR command also does not require spaces between the path and the parameters. So DIR C:/d and CD C:/d are interpreted differently.
Ridiculous. -- DMahalko (talk) 23:50, 10 September 2015 (UTC)
thread_title:  Inconsistent use of forward-back slashes 

message: Hi! I have used CP/M before I encountered DOS, and I have met batch processing (oposite to time sharing/interactive procesing) on several mainframe computer systems (mostly on CDC Cyber under NOS/BE, and Facom F180/II AD under Facom OS IV/F4, and later under IBM OS VS/MVS, between 1979 and 1995), which both (in different ways) supported batch procesing. The idea at that time and that environment was that same program could process same information regardless how it came to it, and that operating system should supply interface to interative entry of data to the program and presenting results on terminal,  or connect it to a data set  (file) to process a mass of same type of data and output the result where requested (data set/file, screen, printer...). 
DOS in the beginning had similar architecture (e.g. copy con example.txt etc.), and cmd window still emulates part of it, but many (most?) of the current programs seem to be written around user interfaces, and I feel most of programming effort in visual development environment is around user interfaces instead of problem solving  (and using same problem-solving-code for interactive of batch processing is no more trivial as it used to be).  
The sources I used for that (much of it paper) are unvailable now so by WP policies I can't write on that in articles. 
Anyway I think a disambiguation page between .bat/.cmd script language and batch processing (and a hatnote to it here) might be usefil. --Marjan Tomki SI (talk) 15:10, 19 March 2022 (UTC)
thread_title:  Batc file and batch processing in other systems