dos

Batch script to take backup of all *.c and *.h files.

I am new to MS batch programing. I want to copy files with matching regex to destination with same directory structure. If I use dir /b /s, I get full path of source then how can I get the relative path from source path? I want DOS based batch script equivalent of something like this in bash script, file_list=`find ./abc/test -nam...

Assembly INT 13h - read disk problem

Hi to all I need to be able to write a program in assembly to read the first sector of a disk (The MBR) and write it to a floppy disk or at least show the data. I understand that INT 13h and 25h do not work in the windows protected mode and i even tried my code in Dos but the dos system hangs when I run the program. This is the code: ...

MBR says Invalid partition table - But system works! WHY?

I have been given an end of term project to write an assembly code to read the MBR and save it to floppy. I think I managed to read it with INT 13h in DOS in a virtualBox machine. The machine has only one hard disk with one partition with XP installed. When I read the MBR and print it, it gives me a whole lot of junk and amongst the jun...

dos: find a string, if found then run another script

Hi, I want to find a string in a file using dos. e.g. find "string" status.txt And when it has found it, i was to run a batch file (like an if-else statement). How can I do it? Regards Manjot ...

Forgot how to delete folders with subfolders in dos.Can you help?

Hi all I thought I would never use dos again.I wrong I was/am. I am trying to delete a folder with this structure "MyFolder" AnotherFolder AnotherFolder Folder1 Folder2 Folder21 etc... I do this get the cmd prompt go to my folder cd MyFolder type attrib -R - A -S -H C:\MyFolder (remove all attributes eg re...

Shutdown computer in MS-DOS using ACPI

I have MS-DOS 6.22 running on a Pentium based computer (motherboard supports ACPI), and would like to know if there was an assembly language routine I could use to shut down the computer, or is it a little harder than that (i.e. motherboard specific)? Basically, I want to create a small program to shut down the computer from the command...

How can I get a directory listing from DOS in Perl?

I need to get directory names from the path passed to the Perl script as run time argument. Here is the code I'm using: $command ="cd $ARGV[0]"; system($command); $command="dir /ad /b"; system($command); @files=`$command`; But it still returns the directory names inside the directory from which I'm running this Perl script. In short,...

Need some major batch-fu.

I have this massive folder structure with thousands of folders and subfolders. I need to copy all the DLLs from this structure into a single folder. I've tried the xcopy *.dll c:\output /S /E but that copies the DLLs with the structure. Is there a way to do what I want in a batch file using DOS commands only. ...

Call URL with wget and return an ERRORLEVEL depending on URL's contents

A client has a Windows based in-house server, on which they edit the contents of a CMS. The data are synchronized nightly with the live web server. This is a workaround for a slow Internet connection. There are two things to be synchronized: New files (already sorted) and a mySQL database. To do this, I am writing a script that exports ...

How do you suppress environment variable expansion within DOS ?

This is a simplified example with modified variable names of what I want to do. Also for simplicity sake, I am showing the command line version rather than the bat file version. I am doing the following. > echo %foo% %foo% However, if foo is a valid environment variable, I do not get desired output (%foo%) due to environment variab...

Reading/Capturing DOS input for use in MsBuild

Hi all: How do I capture/read DOS input for use in MsBuild? EDITED for clarification Currently I have 2 files. One batch file, the other is the core.msbuild file which contains the msbuild stuff. I want to be able to capture an extra user input e.g. an output directory, from the windows command prompt (when the build file is execute...

dos date/time calculation

I am working on a project that involves converting data into dos date and time. using a hex editor (Hex Workshop) i have looked through the file manually and and found the values I am looking for, however I am unsure how they are calculated. I am told that the int16 value 15430 corresponds to the date 06/02/2010 but i can see no correlat...

DOS EGA Graphics Programming in Mode 0Dh

I'm doing a bit of retro programming for fun. What I want to create is a DOS game using EGA graphics but I am having a bit of trouble finding a good reference on the web. Everybody who talks about doing DOS programming assumes that the programmer will use mode 13h, and although some pages mention the other graphics modes, I haven't fou...

What is the difference between these two forms of inline assembler in C?

Background: I've been tasked with writing a data collection program for a Unitech HT630, which runs a proprietary DOS operating system that can run executables compiled for 16-bit MS DOS, albeit with some restrictions. I'm using the Digital Mars C/C++ compiler, which seems to be working very well. For some things I can use standard C l...

Concatenating space-separated numbers together in a batch file.

I need to randomly generate a number of values in a batch file that share a certain range and concatenate them together separated by spaces. Everything works except for concatenating the space-separated numbers together. The specific problematic issue is concatenating with the numbers with spaces, how do I go about this? The relevent po...

DOS command to format string to hex value

Is it possible to format a string to a hex value using DOS command? I'm trying to pass a hex value to my program from command line but it takes that complete value a a string and not as hex value? ...

How to get file's modifed date on windows/dos command

I have been using the following command to get the file date, however the fileDate variable has been returning blank value ever since we moved to a different server (windows 2003) FOR /f %%a in ('dir myfile.txt^|find /i " myfile.txt"') DO SET fileDate=%%a Is there any other more reliable way to get the file date? ...

How do I get a for loop to work with a comma delimited string?

This is my code so far: for /f "tokens=1 eol=," %%f IN ("1,2,3,4") do ( echo . echo %%f ) I'm expecting that to produce: . 1 . 2 . etc... But instead I get: . 1 And that's it. What am I missing? ...

using variables with the system() function to call dos

I have been trying to write a simple brute force password cracker in C++ to open an old zip file that I locked a very long time ago. I am trying to call pkunzip from the program. The only way I know to do this is using the system() command. As in system("astring");. The problem is that I need to dump a new password into the string ...

turn off screen updating in a dos batch file

I am writing a program in C++ that launches commands from the DOS operating system using the system() command. So far so good I think. But how can I turn off the screen updating in the console window that pops up so I can't see the thousands of messages that are resulting. Or, alternatively, how can I dump those messages in some oth...