dos

Long commands split over multiple lines in Vista/DOS batch (.bat) file

How do I make long commands go over multiple lines in a Vista/DOS batch file? ...

Pause a DOS Console/GNU Makefile if an error occurs

Part of the install for an App I am responsible compiles some C code libraries. This is done in a DOS console using GNU Make. So, as part of the install, a DOS Console window pops open, you see the make file output wiz by as it compiles and links, when finished the DOS Console window closes and the installer continues. All good, unless...

Is there any sed like utility for cmd.exe

I want to programmatically edit file content using windows command line (cmd.exe). In *nix there is sed for this tasks. Is there any usefull equivalent in windows? Edit: I am looking for native command line solution. ...

Windows batch command(s) to read first line from text file

How can I read the first line from a text file using a Windows batch file? Since the file is large I only want to deal with the first line. ...

How to check if directory exists in %PATH%?

How does one check if a directory is already present in the PATH environment variable? Here's a start. All I've managed to do with the code below, though, is echo the first directory in %PATH%. Since this is a FOR loop you'd think it would enumerate all the directories in %PATH%, but it only gets the first one. Is there a better way of...

Upgrading DOS Batch files for Windows

Has anyone had any recent requirements for programming automated DOS Batch style tasks on a Windows box? I've got some automation to do and I'd rather not sit and write a pile of .BAT files in Notepad if there is a better way of automating these tasks: mainly moving of files under certain date and time conditions, as well as triggering ...

How can I debug a .BAT script?

Is there a way to step through a .bat script ? The thing is , I have a build script , which calls a lot of other scripts , and I would like to see what is the order in which they are called , so that I may know where exactly I have to go about and add my modifications . ...

Sleeping in a DOS batch file

When writing a batch file to automate something on a Windows box, I've needed to pause its execution for several seconds (usually in a test/wait loop, waiting for a process to start). At the time, the best solution I could find uses ping (I kid you not) to achieve the desired effect. I've found a better write-up of it here, which describ...

Windows/Dos scripting FOR command to rename all files in a directory

I am trying to rename all the files present in a windows directory using FOR command as follows at the dos prompt: for %1 in (.) do ren %1 test%1 E.g. This renames a file enc1.ctl to testenc1.ctl enc2.ctl to testenc2.ctl Thats not what i want. What i want is enc1.ctl renamed to test1.ctl enc2.ctl renamed to test2.ctl How do i ...

How to create empty text file from a batch file?

Can somebody remember what was the command to create an empty file in MSDOS using BAT file? ...

Unexpected variable subst behavior in DOS .bat file

What will the following DOS .bat file code segment display? Why? (i.e. why doesn't it behave as you might first think)? set VAR=before if "%VAR%" == "before" ( set VAR=after; echo %VAR% ) [I do know the answer to this, but figured this valuable enough to post] ...

Can any body tell me what is list file and map file in c?

hello friends, I am Manoj again here to ask you my doubts. I heard that in turbo c when we are doing projects with more than one source file then we can generate list file and map file . What are they? what do they contain? And how to generate them using the commands at MS-DOS command prompt using tcc for turbo c? How to generate the ass...

Do you know a similar program for wc (unix word count command) on Windows ?

A quick search gives me tawbaware wc, but it does not accept stdout as input stream, meaning I can not use pipe within a DOS session. Note: I can not install cygwin or use powershell (which would have allowed a '|foreach-object {(get-content $_).count}') unxutils and and gnuwin32 Packages might have this feature... ...

How do I perform string operations on variables in a for loop?

This sounds dumb, but I can't get it to work. I think i just dont' understand the difference between %%v, %v% and %v Here's what I'm trying to do: for %%v in (*.flv) do ffmpeg.exe -i "%%v" -y -f mjpeg -ss 0.001 -vframes 1 -an "%%v.jpg" This successfully generates a thumbnail for each of the movies, but the problem is: movie.flv -> m...

How to find files with ^M from linux using csh

Is there a csh script/command to list all the files in source source tree which have line endings that show up as "^M" in emacs (under linux). Thanks! ...

Batch file script to remove special characters from filenames (Windows)

I have a large set of files, some of which contain special characters in the filename (e.g. ä,ö,%, and others). I'd like a script file to iterate over these files and rename them removing the special characters. I don't really mind what it does, but it could replace them with underscores for example e.g. Störung%20.doc would be renamed ...

monitoring file access of an old dos game.

Hi, I have a bit of an unusual question. I'm running an old DOS game in dosbox under windows xp and i'm trying to determine when and where it access it's data file. what can i use that will give me a log of all read requests made to a file? I want to know the "when", "from" and "size" of each file read. I know my basic 8086/8088 assem...

Simple DOS command-line to ignore data on a line after the last backslash

I'm creating a batch file to make multiple directories from a list in a text file however after the directory is listed sometimes a filename is as well. Is there an easy way to have it ignore all data after the last \ on a line? ...

Windows Xp or Vista: How can I run a batch file in the background (no windows displayed) ?

I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch: from another batch without any DOS windows displayed with all arguments passed to the invisible batch The first batch is executed in a DOS windows. However, I do not want the second batch...

Handling nmake errorlevel/return codes

Hi all, I have an nmake-based project which in turn calls the asp compiler, which can throw an error, which nmake seems to recognize: NMAKE : fatal error U1077: 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe' : return code '0x1' However, when I call nmake from within a batch file, the environment variable %ERRORLEV...