batch-file

What exactly is this batch file supposed to do?

What does this do in a .bat file? Is it some sort of assembly language or what? @debug <%0 >nul e100 48 e6 61 be 3f 01 31 db 8a 1c 80 fb ff 74 f4 81 e110 c3 d0 00 b0 b6 e6 43 31 d2 66 b8 dd 34 12 00 66 e120 f7 f3 e6 42 88 e0 e6 42 46 8a 0c 46 ba da 03 ec e130 a8 08 74 fb ec a8 08 75 fb fe c9 74 c9 eb f0 00 e140...

How can I open a message box in a Windows batch file?

I'm kind of going through DOS again and it's been ages, so I need a lot of help. My question is; how can I make a batch file open a popup screen? Like: Sorry for the poor English, I'm Dutch/Italian >.< ...

How do I get the equivalent of dirname() in a batch file?

I'd like to get the parent directory of a file from within a .bat file. So, given a variable set to "C:\MyDir\MyFile.txt", I'd like to get "C:\MyDir". In otherwords, the equivalent of dirname() functionality in a typical UNIX environment. Is this possible? ...

Find USB Drive letter

I need to get the drive letter of the usb pen drive.the command CHDIR >drive.txt gives me the drive letter L:.How do I read/get this info "L:" without quotes into a variable in my batch file ...

How do you strip quotes out of an ECHO'ed string in a Windows batch file?

I have a Windows batch file I'm creating, but I have to ECHO a large complex string, so I'm having to put double quotes on either end. The problem is that the quotes are also being ECHOed to the file I'm writing it to. How to you ECHO a string like that and strip the quotes off? UPDATE: I've spent the last two days working on this an...

Append data to log file, .bat

this .bat file is used for website replication, transferring files from development to prodution and then produces a log file with job stats. I'd like to included the name of the user that kicked executed the .bat within the log file. is this possible. So far i've only been able to include the user's name within the file name of the lo...

Directory Names in Batch

How can I store a directory name in a variable inside batch file?? ...

How does "FOR" work in cmd batch file ?

I've been programming in dozens of languages for 20 years but I could never understand how "FOR" work in windows cmd shell batch file, no matter how hard I tried. I read http://www.amazon.com/Windows-Administration-Command-Line-Vista/dp/0470046163/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1241362727&amp;sr=8-1 http://www.ss64.com/nt/for...

append text file data to log file, .bat

this .bat file is used for website replication, transferring files from development to prodution and then produces a log file with job stats. I'd like to included the contents of a text file at the end of the log file. is there any easy way to do this? @ECHO off IF "%1"=="" goto :Syntax for %%d in (%1) do call :sub0 %%d goto...

In Windows, what's the most efficient way to compare two files and return just the records missing in the second file that were originally present in the first file?

At regular intervals we are receiving CSV files from an external source that we have little control over. These files are complete sets of current records; however, any records that have been deleted since the previous are not present. We would like to compare the two files and create a separate file of deleted records so we can do som...

VB Script Text File Prepend

Anyone know how to quickly prepend (add two new lines of text) to the start of an existing text file using either VB Script or a Bat file? Most elegant solution gets the tick. ...

Windows batch file for iterative invocation of other batch files

Consider a directory structure containing the following files: \1.3\Baseline\GeneratedScripts\One\FullInstall.cmd \1.3\Baseline\GeneratedScripts\Two\FullInstall.cmd \1.3\Baseline\GeneratedScripts\Three\FullInstall.cmd \1.3\Patches\Patch1\GeneratedScripts\One\FullInstall.cmd \1.3\Patches\Patch1\GeneratedScripts\Two\FullInstall.cmd \1.3\P...

How do I check that a parameter is defined when calling a batch file?

I'm trying to use the following validation logic in a batch file but the "usage" block never executes even when no parameter is supplied to the batch file. if ("%1"=="") goto usage @echo This should not execute @echo Done. goto :eof :usage @echo Usage: %0 <EnvironmentName> exit 1 What am I doing wrong? ...

Set variable to result of "Find" in batch-file

I would like to set a variable based on the number of lines in a file that contain a give string. Something like: set isComplete = 0 %isComplete% = find /c /i "Transfer Complete" "C:\ftp.LOG" IF %isComplete% > 0 ECHO "Success" ELSE ECHO "Failure" Or: set isComplete = 0 find /c /i "Transfer Complete" "C:\ftp.LOG" | %isComplete% IF %i...

Recovering from an invalid GOTO command in a Windows batch file

In a Windows batch file, I am taking an optional parameter that allows the caller to jump to the middle of the batch file and resume from there. For example: if [%1] neq [] ( echo Starting from step %1 goto %1 if %errorlevel% neq 0 goto error ) :step1 :step2 ... goto end :error echo Error handler ... :end If the supplied paramet...

How can I get a drive list from a batch file?

I'm trying to get a list of all my mapped drives for a system upgrade and would like to get this info via a batch file. How can I do this? For Bonus points: How can I script the mapping of these drives on the new server? ...

Batch File not exiting loop correctly?

Hi All, I am working on a batch file to gather the mac addresses of two of my subnets clients however for some reason my batch file is not ending the first loop correctly, so the second loop is not being executed and thus the rest of the script is not being executed. Any ideas on why this is happening? for /L %%i in (1,1,254) do ping.b...

Visual Studio inserts invalid characters in batch files

I've got some batch files that I use to help automate the process of creating and reloading development databases. It makes sense to create and maintain these batch files in Visual Studio (i.e., in a VS Database project). They look pretty simple, like this: @echo off echo Setting server and db from defaults. set SERVERNAME=(LOCAL) set...

Windows Batch file debugger?

Is there a program like Visual Studio that allows you to debug (dos) batch files? What techniques could I use to debug? Martin Brown answered a batch file question with a nice for / each loop. I would love to see the values of the variables as they loop. for /R A %i IN (*.jpg) DO xcopy %i B /M ...

How to append a date in batch files

I have the following line in a batch file (that runs on an old Win2k box): 7z a QuickBackup.zip *.backup How do I append the date to the QuickBackup.zip file. So if I ran the batch file today, ideally, the file would be QuickBackup20090514.zip Is there a way to do this? ...