PowerUsers.info - Paul Doherty Askme Archive of Questions and Answers

Return to AskMe Archive Main Page

Return to Main PowerUsers.info Main Page

Category : DOS


----------------------------------------------------------------------
FAQId : 4377925
Subject : .class files

Question : Dear all,

Recently I have opened a .class files by notepad. Since then, whenever I downloaded software that contain .class files, all the files are appeared in a notepad icon. Would you please tell me how to restore them in their original icon?

Regards,

Christine

Answer : Ah I see some of my esteemed colleagues remembered better than I that .class files are Java files. In any event that helps you know which program to associate the .class files with - the Java interpreter.

Answer : To change the association for any file extension:

Open an explorer window so you can see one of the files of that type.

Left-click the icon once to select it.

While holding the SHIFT key right-click the icon and a new item will appear in the menu (Open With). Select that menu item.

Select the application you want to handle that extension (ensure that the check box at the bottom is selected so the selection is permananent) either in the list or by browsing to the EXE for that application.

--
Paul Doherty
http://members.home.net/iqueue

Answer : Generally that extension is unused - it would seem you may be using a compiler like C++ that uses class modules? If that is the case then the .class module should probably open into your compiler's IDE (Integrated Development Environment) where it can be edited. There is no harm leaving it associated with notepad or wordpad if those are preferred for edits.

--
Paul Doherty
http://members.home.net/iqueue

Rating :

FUQuestion : Dear Paul,

Thank you very much for your prompt response to my enquiry. However, my problem is I don't know which application should I use to convert (handle) the .class files into their original icon. Do you have any suggestions?

Cheers,

Christine

----------------------------------------------------------------------
FAQId : 4434418
Subject : a dos question

Question : a while ago I discovered that you could make directories inaccessible to people who don't know how to use DOS. here's how: you either rename or create a directory with the null (ALT+255) character then when you try to access it through windows it can't be found, moved or renamed... now here's my question: I'm a lazy person so I want to be able to make a batch file that will rename the null directory to a reguler one but when I try to do it it says "file not found - [the null directory]." Is this possible to do?

Answer : You certainly can, but as someone mentioned your choice of editor may limit the use of those extended characters. Try it the hard-core way like I do - don't use any editor at all! This is the failsafe method of creating files that is highly useful since not everyone has a text editor in their DOS (or it may become damaged, or you boot from a rescue floppy and don't have edit.com handy, etc). I like techniques like this because I always want to be able to get things done, even under the worst of circumstances.

To create and test what you're trying to do I did the following (anywhere you see *255* in the following that indicates where the ALT+0255(on the keypad) has been typed and where you should type it to get the same result - "^Z" means press CTRL-Z - it will terminate the file (it's the EOF character (End Of File)):

c:
cd \
md temp
cd temp
md *255*
cd \windows\command
copy con open.bat
@echo off
c:
cd \temp
attrib -h *255*
ren *255* visible
cd visible
dir /w /o /p
^Z

copy con close.bat
@echo off
c:
cd \temp
ren visible *255*
attrib +h *255*
cd *255*
dir /w /o /p
^Z

--
Paul Doherty
http://members.home.net/iqueue
Home of PC DiskMaster and DOS/Windows Utilities
Rating :

----------------------------------------------------------------------
FAQId : 4929252
Subject : MS-DOS

Question : Hi, I am having trouble with a question for school on DOS. The question is: First, Make Drive A: my current drive.......then Change the command prompt to show the current date and my last name on one line and the current path on the next line.

Could you please help me on this, I just cant seem to get it......I am using DOS 6.22
Thank- you

Answer : Assuming you have ansi.sys already being loaded in your CONFIG.SYS here's how:

PROMPT=$d LASTNAME$_$p$g

'$d' gives the date
LASTNAME is your last name
$_ is a CR (Carraige Return) and moves the cursor to the next line
$p is the current directory path
$g is the ">" greater-than symbol

--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities


Rating :
End :

----------------------------------------------------------------------
FAQId : 4936556
Subject : using fdisk to partition

Question : I've used fdisk to create 2 partitions on my hard drive. I create a primary DOS partition as my active, boot drive (c: drive). Then I created an extended drive and made it my logical drive. The problem is, fdisk made this new partition the D: drive and changed my CD-ROM to E: drive. But I'd like to keep my CD-ROM my D: drive and make this new partition my E: drive. Is there a way to change this back? Thanks for your help.

Mark

Answer : Yes you can change it. Open the System control panel, then go into the Device Manager tab. Open the CD-ROM section, double-click your CD drive, go to the Settings tab and under First Drive and Last Drive set it to F:

Now under the hard disk section of Device Manager do the same to the hard disk (IDE drive), only set it to E:. Reboot and when you get back up go in for the last time and set the CD-ROM to the now-vacated drive letter D: and reboot.


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : You may have to reboot after the first change (CD from E: to F:)
Rating : after setting the First drive and last drive in the CD-Rom to F:, I go to the hard disk, but the First/Last drive is lighted out, I can't change it to E: and described above. Any suggestions?

----------------------------------------------------------------------
FAQId : 5175942
Subject : sound problem with old DOS games

Question : I was installing some old games like DOOM, Wolfenstein and Duke Nukem and on all of them I am having trouble with the
sound. Doom and wolfenstein the sound is scratchy, and on Duke it has no sound at all. I tried to change the settings on Duke but then it won't boot up when I do. before I upgraded my computer it worked fine. I usually go to the msdos prompt from Windows 98SE and type in the exe file to start the program. Any tips to try?

My system has an AMD K6-2 450 mhz with a
10.1 gig Western Digital HD, 16 bit sound blaster sound card

Answer : I'm glad I was able to help you!

You may want to try a different joystick. Those gamepads are digital I believe and some DOS apps may not find it or use it successfully. Try a regular analog joystick and see if it works better.

Paul Doherty

Answer : This is very likely due to your not having a properly set BLASTER environment variable. Try adding the following line to your C:\AUTOEXEC.BAT

SET BLASTER=A220 I5 D1 H5 T6

Examine the resources for your sound card under the System control panel in the Device Manager. In the line above confirm that your sound card is at IO address 220, IRQ 5, DMA 1 (8-bit DMA), DMA 5 (16-bit DMA). If any of these are different plug in the correct values.

Now your DOS games should work. Try booting while holding the CTRL key and at the menu choose "Command Prompt Only" and play your games there. You can confirm the environment variable is there with the command:

echo %BLASTER%

You should see something like this:

A220 I5 D1 H5 T6


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities


Rating :

FUQuestion : Thanks your tips helped I have sound now but with all the games I can't use the Gravis game pad that I have plugged into the Sound Blaster 16 sound card. It works in Widows so I know it is reading it but when I start up Doom for example unless I have it set to keyboard only it jumps to diffent options like it has a mind of its own, plus when it works right it usually asks to calibrate the game pad before the game starts.
With Duke Nukem when it is set to use the game pad it doesn't respond at all.
Wolfenstein does the same thing as Doom.
The game pad is a Gravis Game Pad pro (NON USB)

----------------------------------------------------------------------
FAQId : 5332023
Subject : How do I write a script to copy files under a directory structure into 1 file?

Question : I have only written scripts in UNIX but I want to
write a script for WinNT so that I give
a directory as an arguement and any file under
this directory name that I specify (e.g any
html file - *htm* - will be written into one
destination file). I haven't used DOS much
but I know that the copy command creates one
file from if the source files are in the
actual directory i'm in but I can't figure out
how to go down the directory structure looking
for matching file names.

Any help much appreciated

Answer : Look into the FOR command. Something like this will work:

for -f %%i IN ('dir /b /s *.htm*') DO type %%i >> c:\newfile.htm

This will take all the filenames in succession for the current directory and all subdirectories beneath it and concatenate them one at a time into a new file called "c:\newfile.htm".


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating :

----------------------------------------------------------------------
FAQId : 5456295
Subject : batch zip files

Question : I have a huge number of files that need to be individually zipped. I know there is a prog called gzip, but I am not sure how to use it. Is there any easy way to take a disk full of, for example, .dwg files and run some sort of batch prog that will convert these dwg's to .zips? They need to be individually zipped in order to be individually downloadable on the Internet.

Answer : The syntax showed is for inclusion in a .BAT (batch) file. To run it at a command line change all the "%%i" to "%i" (that is, only one percent symbol).

--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities

Answer : Ah I see - use one percent at cmd line, and two inside a BAT file. Try them both ways on the command with the lines to appear as below for cmd line and BAT.

cmd-line

for /f "tokens=*" %i IN ('dir /b c:\download\*.dwg') DO @echo "c:\download\%~ni.dwg"

BAT file

for /f "tokens=*" %%i IN ('dir /b c:\download\*.dwg') DO @echo "c:\download\%%~ni.dwg"

If both of these echo out the lists and they look like this:

"c:\download\20222005.dwg"

then you should be able to use that syntax and just put back in the winzip portion (so for example it would look like):

for /f "tokens=*" %%i IN ('dir /b c:\download\*.dwg') DO @"c:\program files\winzip\winzip32.exe" -min -a -ef -hs "c:\download\%%~ni.zip" "c:\download\%%~ni.dwg"

If you cna't get it working I may have to get off my lazy rear and confirm this still works by creating a similar subdir structure with some files on my NT server. :-(

--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows utilities





Answer : No the filenames are fine. The "/b" generates a "bare" listing with no other date/size/etc info. You may actually be getting duplicate path information from the for loop (I wrote this under NT4 and I'm not positive it's identical under 2000). To test let's run this:

for /f "tokens=*" %i IN ('dir /b c:\download\*.dwg') DO @echo "c:\download\%%~ni.dwg"

Send me a few lines of that output and let's see what it's doing.


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities



Answer : Hmmm... I wonder is 2000 has been changed with regard to the handling of variable substitution? Try that last one in the BAT file with a single percent or just modify the command line to actually do the task and be done with it. :-)


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : I see the problem here... When I adapted my solution to your problem I didn't change the extension at the end... must have overlooked it. The '.pst' at the end of the command needs to be '.dwg' as in:

for /f "tokens=*" %i IN ('dir /b c:\download\*.dwg') DO @"c:\program files\winzip\winzip32.exe" -min -a -ef -hs "c:\download\%%~ni.zip" "c:\download\%%~ni.dwg"

try that and let me know how it works out.

Sorry for the mixup... :-)

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities



Answer : Assuming the .dwg files are in the path C:\DOWNLOAD (on an NT machine) try this:

for /f "tokens=*" %%i IN ('dir /b c:\download\*.dwg') DO @"d:\program files\winzip\winzip32.exe" -min -a -ef -hs "c:\download\%%~ni.zip" "c:\download\%%~ni.pst"


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities






Rating :

FUQuestion : The system cannot find the path specified.

This message is repeated the number of files that exist in the directory.

The path where the files exist is:

c:\download

I am using the command prompt...c:\>

for /f "tokens=*" %i IN ('dir /b c:\download\*.dwg') DO @"c:\program files\winzip\winzip32.exe" -min -a -ef -hs "c:\download\%%~ni.zip" "c:\download\%%~ni.pst"

FUQuestion : Paul,
Thank you for the speedy reply. When I tried this, I got the message, " %%i was unexpected at this time"

Any ideas?
Jacque

FUQuestion : Hi,
I tried that, and got the same message, "The system cannot find the path specified"
Two questions...
what does dir /b refer to?
It does not matter what my files are named, does it? They are a part number .dwg, as in 10050604.dwg
What proceeds the .dwg should not matter should it?

Jacque

FUQuestion : Paul,
I visited your page. Very impressive. I'm counting on your patience, since you have experience teaching a tough age group!
I changed the double % to a single % and now it is running, but giving me the message that it cannot find the path specified. Since the message is repeated the number of times equal to the number of .DWG files, I'm guessing I'm close, but not there yet.
I am running 2000, have just A-floppy, c-drive, and d-CD-rom.
And my winzip is in c:\programfiles (which I changed from your code)
If you have a simple suggestion great! But I don't want to create any stress!
Thanks,
Jacque

FUQuestion : An output sample is:

"c:\download\%20222005.dwg"

This is repeated times the amount of files I have in the download directory...insert each part number in place of 20222005.


FUQuestion : Hi Paul,

when I ran this-
cmd-line

for /f "tokens=*" %i IN ('dir /b c:\download\*.dwg') DO @echo "c:\download\%~ni.dwg"

the output was a list as desired:
"c:\download\20222005.dwg"

when I ran this-
BAT file

for /f "tokens=*" %%i IN ('dir /b c:\download\*.dwg') DO @echo "c:\download\%%~ni.dwg"

the output was:
%%i was unexpected at this time

Jacque

Need More Information : Can you give me:

The exact error message being reported

The exact path where the files actually exist

The entire line you are executing

Paul Doherty

----------------------------------------------------------------------
FAQId : 5456329
Subject : How can I make my computer boot to dos?

Question : I would like to make my computer start up in dos mode. Then start windows from there. I am running windows 98 SE.

Answer : Rate the answers you receive on Askme.com....


Answer : ME to my knowledge cannot boot straight to DOS - they have done all they can to remove DOS from the underpinnings of ME and as a result you cannot boot to DOS. Very dumb, IMO... you can use a bootable floppy (after which you can still see the contents of the C: drive and do what you need to do).


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : Open a DOS prompt and issue the following commands:

attrib -r -h -s c:\msdos.sys
edit c:\msdos.sys

(look for the section titled [Options] and add the next line below that header)

BootGUI=0

Save the file and now when you reboot it will stop at DOS. You can type "win" to enter Windows any time.


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating :

FUQuestion : Thanks Paul. How would you do this if you are running Windows ME?

Thanks,
Alvin

----------------------------------------------------------------------
FAQId : 5518553
Subject : Disconnet from a network mapping...

Question : Hi paul,

can you please tell me how to disconnect the mapped drive from the dos prompt? also, when you
copy files from a server to a connected computer,
what the "$" stand for? example:
"xcopy c:\master\*.doc \\station\c$\share".
thanks a lot for your help...!
sammy. ;-)

***

Answer : To disconnect a drive:

net use x: /delete

where "x:" is a previously-mapped drive.

The "c$" usage refers to the so-called "administrative share" that allows a user with the proper credentials to access the root of each drive on a networked Windows box without there being an explicit share having been made available.

--
Paul Doherty, CNE, MCP+I, MCSE, CCSA, CCSE
http://members.home.net/iqueue
Home of DOS/Windows utilities

Rating :

----------------------------------------------------------------------
FAQId : 5536934
Subject : dos extract

Question : Hello,
can anyone tell me EXACTLY how to use the extract feature for DOS (using win.me)if it is of any help i am trying to locate and extract
shelliconcache which has gone missing on my pc.
Ta very much

Answer : Here's the way I do it.

First extract a list of the contents of every series of CAB file from your CD. Assume your CD-ROm is drive letter X: and that the CAB files are in a directory on there called \WIN98 (I'm using 98 but the process should be identical in ME).

Open a DOS prompt and make a dir on your hard drive:

md c:\cabs

cd into the new dir
c:
cd \cabs
dir /w /o x:\win98\*.cab
(note the "clusters" of names that the CAB files are in - we will be using the first of each series to collect the information we want)

Enter the following command for the first filename in each series of CAB files - for example the first series I see at the top of my dir output is BASE4.CAB (accompanied by BASE5.CAB and BASE6.CAB)

extract /a /d x:\win98\base4.cab >> cablist.txt

In the end you will have a file called:

c:\cabs\cablist.txt

that will list every file stored anywhere in your CABs and you can then isolate what file you need by searching that file. Once you know what CAB file the file you need resides in you can use this to get at it:

extract /e x:\win98\YYYYY.CAB file.exe

where file.exe is the file you are after.

--
Paul Doherty, CNE, MCP+I, MCSE, CCSA, CCSE
http://members.home.net/iqueue
Home of DOS/Windows utilities



Rating : perhaps i should have said simple instructions
thanks

----------------------------------------------------------------------
FAQId : 5615471
Subject : Arj compressing , plus moving recursive files AND SUBFOLDERS

Question : Hi
I want to know how to compress recursively, arj file and subfolders and to MOVE them to the arj archive
thanx
(i want to delete the fles and folders from the original folder)

Answer : Add a deltree command after the ARJ to remove the dirs:

c:
cd \stuff
arj m -r newfile.arj *.*
deltree *.*

Be careful and test as this will nuke all files and dirs!

If you need to maintain long filenames use an archiver besides arj:

http://hem.passagen.se/magobe/Hemladdning/Filer/ACE32.EXE

What do you mean by "maintain the window's name"?

--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities


Answer : I see two ways to approach it:

1) use the method I gave you above, adding a script that deletes the empty directories left behind after the archives are created.

Alternative 1b) ignore the now-empty directories as they use almost no space

2) write a custom script and run it on a scheduled basis that obtains the names of the dirs that are 3 months old or older and archives/removes them.

I could perform #2 for you and produce an EXE you could use to easily do this. If you are interested in hiring me for such a task I would expect it to take no more than a few hours of effort to produce.

--
Paul Doherty, CNE, MCP+I, MCSE, CCSA, CCSE
http://members.home.net/iqueue
Home of DOS/Windows utilities

Answer : If you only want to "clean" (define that please) files and dirs under the selected directory that are older than 3 months then you don't want what it appears you are asking (namely to remove all subdirectories) since they may contain some of the files not older than 3 months.

I guess I'm still not clear on what you're attempting. Also you may just want to use WinZip for this. You'll use a command like this:

"c:\program files\winzip\winzip32.exe" -min -m -r -ef -hs e:\newfile.zip @e:\backup\backup.txt

A nice thing about this command-line is that you can store the directories you want to backup this way, one per line, in the file e:\backup\backup.txt (change to the real path and filename you use) and they will all be backed up into this same archive. The file might look something like this:

e:\home\*.*
e:\shared\*.*

The command-line above then would move all files under "home" and "shared" to the archive, deleting the originals as it goes, and would preserve the long filenames.


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : cd to root of directory for files to go into archive
arj m -r newfile.arj *.*

This will remove all the files and leave the empty subdirectories.


And use this to extract with subdirectories intact:

arj x -y newfile.arj


--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities

Rating :
Rating :

FUQuestion : Thanx man,
But as i can see, there is no option in WinZip that do the same action as "OB" that ARJ has.
That means I cant choose the files and folders i want to Compress and delete.
Let me (Please) explain what i need to do:
I got a main folder and this folder contains many many subfolders (only sub folders).
each subfolder is unique and created only once with its sub folders.
After a while (3 months from its creation) i dont need this subfolder - burden on the main folder and i got no use with it only with the new subfolders (less then 3 mounth).
I want to execute a periodic batch file to compress and move from the min folder all the subfolders that are older then 3 months.
i hope i was clearer now (sorry).
help is needed very quick for the main folder is cracking.
thanks.

FUQuestion : Thanx
But i want to know if there is some way to remove the empty folders in the same action.
If not , how can i delete these specific empty folders later, assuming I didnt arj all of the folders there (using /ob time flag)

FUQuestion : And How can i maintain the window's name and not to get the DOS's short 8 characters name ?

FUQuestion : Let me explain :
I got a main folder that continuously been enlarge.
So, i want to clean it periodically. that means - every three month.
the problem is that i have to clean only what is OLDER then 3 month.
and the new files and folders will stay at the origin main folder.
Also I want to MOVE all the files and SUB Folders that i compressed.
Also I want to keep long filenames.

Thanx
End :

----------------------------------------------------------------------
FAQId : 5636977
Subject : DOS rescue

Question : I have heard a lot on backing up the registry(win98/win95).

MY question is very basic that I am ashamed to ask..

When I backup the registry,can I put the files in a floppy disk(one or two)?
Suppose I already have the backup, and my PC boots to DOS prompt only,how would I be able to restore trhe registry and get my win98 running?

Answer : The registry files can vary in size. In the beginning they may both easily fit on a floppy but as they grow you may find it more difficult to keep them on one unless oyu compress them. But in any event keeping registry backups on floppy doesn't make as much sense as keeping them on the same hard drive with the operating system. Why? I'm glad you asked. The primary reason being that if the reason you're keeping the registry backups on a floppy is to protect against hard disk disaster. If the hard drive fails the registry backups kept off the computer will be nigh-to-useless anyway, as they refer to things that no longer exist, even if you reinstall as closely as possible to the original install. So your registry backups should die right along with the hard drive should disaster strike. Full backups of the whole hard disk are the only place that is good for storing registry backups, since the backups will include the installed drivers and programs along with the registry.

Now as for making and restoring backups of the registry.

To make a backup of the current registry:

Open a DOS prompt

c:
cd \windows
attrib -r -h -s *.dat
copy user.dat user.bak
copy system.dat system.bak
copy system.ini sysini.bak
copy win.ini winini.bak
attrib +r +h +s *.dat
attrib +r +h +s *.bak

Now you have backup copies named ".bak" of each of the associated files.

Restoring them involves the same steps, just with reversed parameters on the copy commands. For example the "copy win.ini winini.bak" command becomes:

copy winini.bak win.ini


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating :

----------------------------------------------------------------------
FAQId : 5677742
Subject : Problems starting DOS from WINDOWS 98

Question : My pc uses Windows 98 SE. I have an application that works only in DOS. To get into MS-DOS from
windows, I select start, shutdown, restart in MS-DOS. This works, but not all the time. Sometimes the pc "hangs up" with the screen dark and the cursor blinking in the upper left corner. I've shutdown all programs running in the background, but no help. How else can I get into DOS? I've also tried the F8 key at bootup, but no help either. BTW, I can't use the "MS-DOS" prompt from the start/programs menu, since my application won't work from it. Thanks for your help.



Answer : Some drivers or applications take liberties with your system and modify the file that gets run when you "Restart in MS-DOS mode". The file in question is:

\Windows\dosstart.bat

Edit this file and REM out any lines that you think may be causing the problem. Something as simple as a mouse driver here can hang and cause you not to get your DOS prompt. The easiest way to handle this is to REM out all lines and try opeing up a few at a time to see when the error starts.

Line before REM:

c:\windows\mouse.com

Line after REM:

REM c:\windows\mouse.com


--
Paul Doherty, CNE, MCP+I, MCSE, CCSE
http://members.home.net/iqueue
Home of PC DiskMaster and other Windows utilities

Rating : Thanks!

----------------------------------------------------------------------
FAQId : 5677813
Subject : NO sound when playing dos games !

Question : i cannot hear sounds while playing dos games, wat is the problem..and some times when i restart my computer in dos-mode to play the game i recieve a message that says "i cannot find the sound card" or "i cannot find the mouse"
please help me... it is very annoying to play games without sounds...(the game require sound blaster.)(i don't have a sound card, my speaker is plug&play)

Answer : You will need a mouse driver loaded to be able to use the mouse in DOS (unless you're using DOS under Windows). Mouse.com or Mouse.exe are usually the names assigned to the drivers. Try any of these until you find one that works - then copy it to your C:\WINDOWS\COMMAND directory and add a line in C:\AUTOEXEC.BAT (or C:\WINDOWS\DOSSTART.BAT - run when you Start/Shutdown/Restart in MS-DOS mode).

http://download.lycos.com/swbasic/BasicResults.asp?query=mouse.com

Also DOS-based programs rely on an environment variable called BLASTER to find the sound card.

First, inside Windows open the System control panel and then open the Device Manager tab. Under there find the section with your sound device and when you find it double click it to see it's Resources tab. Inside there write down the IRQ (Interrupt channel), DMA channels and IO (Input/Output) addresses that the sound card is using.

Here is an example BLASTER line from an C:\AUTOEXEC.BAT (you can either put your line in this file or you can type it directly at the command line or in a BAT file of your choosing):

SET BLASTER=A220 I5 D1 H5

In the above example:

A220 is the IO address
I5 is the IRQ number
D1 is the low DMA channel
H5 is the high DMA channel

Once that variable is set correctly the DOS games should find it fine. If they support that type of card you will get sound.

As for getting DOS games to use the sound card *while still within Windows* see this site:

http://www.texramp.net/techbits/DosGames.html


--
Paul Doherty, CNE, MCP+I, MCSE, CCSE
http://members.home.net/iqueue
Home of PC DiskMaster and other Windows utilities


Rating : Best... I would kiss you if i would.. ^0^

----------------------------------------------------------------------
FAQId : 5807733
Subject : registry restoring

Question : I have found problems with dos when restoring registry of win95.

I understand that the command for the restoration of registry is

c:\scanreg /restore.

Why is it that when I type this command I get the message:

"Bad command"?

or

"wrong dos version" and yet I have ver 6.22?


Answer : To restore the registry just do it manually. Scanreg is just a front-end for this process.

To restore the registry in Win 95 do this:

Boot to pure DOS by pressing F8 just after the RAM test.

cd \windows
attrib -r -h -s *.da?
copy system.dat system.ped
copy user.dat user.ped
copy /y system.da0 system.dat
copy /y user.da0 user.dat

Reboot. If you decide that the registry you put on is worse than the old one do this to reinstate the ones that were there in the first place:

cd \windows
attrib -r -h -s *.*
copy /y system.ped system.dat
copy /y user.ped user.dat

If you decide neither the current registry nor the backup are any good you can take the drastic step of making Windows believe it's the very first boot after a Windows install by doing this:

cd \windows
attrib -r -h -s \system.1st
attrib -r -h -s *.dat
copy /y system.dat system.ped (in case you want to restore it)
copy /y \system.1st system.dat

Reboot.

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating :

----------------------------------------------------------------------
FAQId : 5993084
Subject : help writing at .bat file

Question : Hello,
I need to write a simple .bat file, and I stink at DOS syntax. So if you don't mind, take a look at what I have written below, and help me with the syntax. The stuff in brackets is what I need help with. Thank you!

cd v:\formware\tmp
move rejdump2.txt [today's two-digit month and day, like 0627.rejdump2.txt]
cd v:\formware\jobflow
move claims.log [today's two-digit month and day, like 0627claims.log]
pkzip h:\edi\production_imaging\captiva\claims_logs\[four-digit year, two-digit month]claims.zip [the new claims.log file renamed above]

Do you see what I'm doing? I'm trying to automate something I do every day into a .bat file, so I can just put an icon on my desktop and it will do this stuff itself. I have to manually type all this out now and it's just a waste of time. I know there's an easier way, i just don't know DOS syntax. If you can help, I rate well. :) Thank you!

- Suzy

Answer : It appears you missed the subtleties in the readme.txt file. You used the example showing how to use dateset at the command-line, instead of from a BAT file. The next section after that example you used shows how to use it within a BAT file, which requires that you "call" the BAT file, not run it directly as you indicated you did.

From the readme.txt:

"To use it in a BAT file is quite easy. Just include the following lines at the beginning
of every BAT file that you need the dates accessible:

@echo off
c:\windows\command\dateset.exe
call c:\mydate.bat

and then include the lines that do what you need to do using %MYDATE%, %MYDAY%, etc when you need the appropriate item inserted."

Note the "call c:\mydate.bat". When you call a BAT file in this manner you can retrieve the environment variables in the original BAT file. The way you executed it a new instance of command.com is run and the variables are built in it. Then when that BAT file (mydate.bat) exits those variables cease to exist. Add the call and you will have much better luck. :-)

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : I wrote a utility that gets around this limitation in DOS (using output from one command ("date" for instance) and uses it as a variable of argument with another command. For what you are doing grab my program DateSet from my web page below.

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating : I installed file as explained, then write this .bat file...

---------------------------
dateset
c:\mydate.bat
move v:\formware\tmp\rptdump2.txt

v:\formware\tmp\%MYDAY%%MYMNOTH%rptdump2.txt
move v:\formware\tmp\rejdump2.txt

v:\formware\tmp\%MYDAY%%MYMONTH%rptdump2.txt
move v:\formware\jobflow\claims.log

%MYDAY%%MYMONTH%claims.log
--------------------
...and all it performed was the dateset, and the mydate.bat when I ran it from the command line. I also tried the move commands with the ren that you showed in the readme file, and that didn't work either. More help?

----------------------------------------------------------------------
FAQId : 6028927
Subject : Using XXCOPY with Windows 2000 long file names

Question : Was using XXCOPY 2.40.0 with Win98, no problem. Now I would like to use the newest version that they have with Win2000. I just cannot get around the long file name issue.

I am trying to XXCOPY the c:\documents and settings to another drive to backup the data files that I am using. It would be copies to a directory named the same on the other drive.

I am the only user on this machine so there is not an issue of having to do other directories or having the permissions set.

If you have any information on this program, like the batch file syntax that I would need to make this work, it would be greatly appreciated.

This is the current batch file that I am using and the error that I get:

BATCH:

CLS
REM HOPE TO HELL THAT THIS WORKS
XXCOPY C:\Documents and Settings D:\Documents and Settings /BU


ERROR:


C:\>REM HOPE TO HELL THAT THIS WORKS
C:\>XXCOPY C:\Documents and Settings D:\Documents and Settings /BU
XXCOPY Ver 2.44.4 (c)1995-2001 Pixelab, Inc.
Extra argument (Settings)ignored
Extra argument (D:\Documents)ignored
Extra argument (and)ignored
Extra argument (Settings)ignored
Copying with the template,"Documents" from every directory in C:\.
(This warning can be suppressed by /WD0.)
Is this what you really want (Y/N) ? NExit code = 33 (Aborted by user)
C:\>


All help is appreciated.

DILLIGAS

Answer : You are encountering a common problem with long filenames; namely the space. A space acts as a delimiter for DOS - that is, a space is used to separate items from each other on a command line. By copying those long directory names that include spaces you are essentially sending XXCOPY many more arguments than it expects. XXCOPY's syntax probably looks something like this:

XXCOPY Source Destination

What you've sent (when broken up with the spaces) it would be XXCOPY followed by 7 parameters (look for spaces). Try it like this for the result you're after:

XXCOPY "C:\Documents and Settings" "D:\Documents and Settings" /BU

Adding the double quotes around the Source and Destination arguments ensures that they will be treated as one argument each.

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating : Now I see why you are rated number 1. On the money and worked like a charm. (Too bad that they only have Excellent as the highest rating.)

DILLIGAS

----------------------------------------------------------------------
FAQId : 6040718
Subject : computer wave files

Question : Please define, 1. MP3 files, 2. Midi files, 3. Wave files. I am new at computers. A friend sent me a CD on an E Mail and I need to know how to record it on my CD burner. Is it possible to play a cassette recorder into the input of the computer and record those audios on a CD in the burner? Thank you in advance for your help.

Answer : First the definitions:

MIDI (Musical Instrument Digital Interface) - these files are typically very small and contain only scoring information (what should be played, when, and for how long). They are played back by a MIDI-compatible player that plays the song with the instruments assigned to the MIDI "channels". These instruments are created by your sound card and may consist of samples actual instruments or synthesized replicas of instruments.

WAV - These are raw audio files that contain digitized sound in a variety of qualities. A typical good "CD quality" WAV file would consist of 44.1 Khz (sampling rate) 16bit audio (sample resolution). Upon playback a sound card's DAC (Digital-to-Analog Converter) is employed to turn this digital bitstream back into analog sound that can be amplified and played on your speakers.

MP3 - These are compressed WAV files. A lossy compression method is employed (the so-called "MP3 algorithm") to take a normal WAV file and remove the parts of it or "smooth" it out in such a way as to reduce the size it takes for storage, but to do so without introducing noise or reducing the fidelity of the sound. MP3 is very good at doing this and can maintain very good sound quality whicl delivering a compression ratio of around 10:1 in relationship with the original WAV file. That is, if you had a 40MB WAV file before compression that played for 4 minutes, after compressing with an MP3 encoder you would have an MP3 around 4MB in size that also played for 4 minutes and is virtually indistinguishable from the original.

As for your question on recording on your computer. Yes you can easily record from other sources. Just get an approriate stereo cable to go from the output of the other device into the "line in" connector of your sound card. Then obtain a program (try CoolEdit below) and then set the line in as your recording source choice. To do so double-click the speaker icon in your systray (bottom-right of the Windows interface) then go to the menu and choose Options/Properties. Click "Recording" and in the list below be sure "Line In" in checked. Click OK and then click the "Select" checkbox below the "Line In" slider to choose it as the recording source. The slider will then set the sensitivity.

Once you've recorded audio you want to put on a CD save the files from the WAV editor to a WAV file. Then use your CD burning app to either burn a data CD with the WAV for use with computers in the future, or to an audio CD for playback on home and car stereos.

WAV editor:
http://www.syntrillium.com/cooledit/index.html

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities



Rating : Thank you very much for your time and the excellent answer. M Kesler

----------------------------------------------------------------------
FAQId : 6172138
Subject : batch files

Question : Hi,
Im a macromedia Flash designer and I've run into a problem.
Im making a standalone flash module for a CDROM and I had to load and play midi files. Flash has inadvertantly not provided midi import, so the only way is thru batch files.

My first problem is solved and now, I can open a midi file and play it too. But, the user is given an option between various midis as also to close the one playing. So if he chooses another midi, while the first ones playing, OR wants to close the one playing he shud be able to do it.This is where im stuck. I cant get the running media player to close.. all my eforts have produced is that another media player opens up in a closed state, i.e not playing.

Im opening the varios midi files thru seperate batch files.

Id be really greatfull if you cud help.
THX in advance.
MIIZ

Answer : I realized you want them to play one after the other rather than be selected in a menu. There is no way to tell when the MIDI file currently playing has finished from DOS. So timing the start of successive MIDI files would be problematic at best. What you could do is obtain the sleep command (URLs below) and invoke it between songs since you'll know the length of the songs.

An example:

C:\WINDOWS\MPLAYER.EXE /play c:\brahams.mid
sleep 300
C:\WINDOWS\MPLAYER.EXE /play c:\bach.mid
sleep 240

Those numbers are in seconds - so I'm expecting 'brahams.mid' to be a little under 5 minutes and then I start 'bach.mid' which is just under 4 minutes.

You can get the sleep executable here:

http://members.home.net/iqueue/SLEEP.EXE

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : You haven't shown your BAT file you're using so it's kind of difficult to troubleshoot it for you. From your description, however, it appears you could benefit from my program KillTask. It will allow you to kill the running playback app before launching another - so when the user picks a sound to play you can automatically stop and close the other *before* launching the next one. It's available on my website below.


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : You could create a menu, similar to this:

@echo off
:start
cls
echo.
echo.
echo ------------------------------------
echo - MIDI PLAYER -
echo ------------------------------------
echo.
echo 1. Debussy
echo 2. Beethoven
echo 3. Bach
echo 4. Brahams
echo.
echo 5. Exit
echo.
echo.
echo Choice:
choice /c:12345 /n /t:1,0
if errorlevel 5 goto exit
if errorlevel 4 goto Brahams
if errorlevel 3 goto Bach
if errorlevel 2 goto Beethoven
if errorlevel 1 goto Debussy
goto end
:Debussy
C:\WINDOWS\MPLAYER.EXE /play c:\debussy.mid
goto end
:Beethoven
C:\WINDOWS\MPLAYER.EXE /play c:\beethov.mid
goto end
:Bach
C:\WINDOWS\MPLAYER.EXE /play c:\bach.mid
goto end
:Brahams
C:\WINDOWS\MPLAYER.EXE /play c:\brahams.mid
goto end
:end
goto start
:exit
cls
echo Thanks for using MIDI PLAYER... have a nice life!
echo.

In the script above you will need the full path (or otherwise make available) to the MIDI files - in the example above I assumed they were at C:\

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities


Answer : Thanks,

in the CLOSE.BAT just put in a killtask command with a partial windowname (the part that will be the same for every MIDI you might play) - something like this:

killtask "Media Player"


If the task exists it will be stopped. If it doesn't nothing will happen.

Is that what you're after?

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : You must not have looked real hard - it's right here:

http://members.home.net/iqueue/sequencer.zip

A quick search for 'sequencer' (no quotes) with CTRL-F would have found it fast.

Enjoy!

(also coming to your email)


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : You're welcome! Also check my website - I wrote a new program last week that may be even better for your task - it's called Sequencer and it's near the bottom of my webpage.


--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating :

FUQuestion : Hi paul...
searched ur site a few times,..the prog. isn't there..
cud you mail it?
Thx
iziaee@yahoo.com

FUQuestion : Hi...
Thanks. I got the SLEEP prg.
Have done as u said, and it works.

Thanks a lot for all ur help.
Ive sent u a personal email.Do check.
Thanks again for the help.
Ishaq

FUQuestion : Hi Paul..
Thanks. I got your application. My originalBAT file (launched by a button in my Flash Interface) for playing the midi is a very simple one that goes something like this :
=======================
:: Purpose : Plays the AHA MIDI file
@echo off
C:\WINDOWS\MPLAYER.EXE/play %aha.mid
exit
=======================
Now the user will be interacting with My flash Interface all the time...., for stopping this midi or choosing another one (thereby stopping the previous one). I have linked a button from my flash interface to another BAT file for him to stop the midi playing.

I want a sript in this (CLOSE.BAT) file to check if the Midi player (MPLAYER.EXE) is playing and if so to stop it.

This shud happen without any inputs from the user.
Is this possible?

Nice site BTW.. but it doesn't show up on batch file searches.. in google.. you shud do something about its rank.
Thx in advance,
Iziaee

FUQuestion : HI..
Its me again

Just a thought...If I'd like to make a playlist in a a BAT file for all the midis (around 10) to play one after the other, what changes wud i make in my BAT file?

THX..

FUQuestion : IT WORKS IT WORKS...
HALLELUJAH..
PAUL Im gonna recommend u to Everybody...
U R THE MAN....
U the president..U the POPE.. U the MAN.

WHew.. weeks of searchin played off.

MAn...what do you do for a living .. u shud get a Nobel Prize.. I mean being an expert n a field that Ol Gates "havent-had-a-decent-upgrade" Boy wants killed!

Zeeeeeeech....

OK that was me stopping myself..

It works fine. Umm. A little hitch though...Iam including ur file in this project.. so like can I??...

Also, I have to make a seperate stop button for each midi file, since i have to spell out (case wise) its name in the bat file, so:

@ECHO OFF
killtask AHA.mid

Is there a way to put a generic "" term instead of the name so that the BAT file picks out whichever .mid is playing and zaps it?

Again thanks a lot .
iziaee

FUQuestion : Hey I just solved it myself..
Put the % and it works....

THX a lot man

iziaee

----------------------------------------------------------------------
FAQId : 6229314
Subject : Creating a unique filename when archiving using xcopy

Question : I am trying to write a simple batch program that will xcopy a file from a directory into an archive subdirectory. I would like the target file to have a unique name every time the file is archived (i.e. a date/time stamp). Are there variables available in dos that can be used in filenames? How do I do this.

Thanks.

-Donald

Answer : My utility DateSet will do this for you. Here is the text from the readme.txt included with the app:

----------------------------------------

DateSet 1.1, by Paul Doherty 2000, 2001

This utility exists to help anyone (usually administrators) who needs to rename or
timestamp files with the current date in an automated way. To use this utility you
will be at a command prompt or running a batch file (.BAT/.CMD). When run DateSet will
obtain the current system date and put it into a new file called C:\MYDATE.BAT. That
file will look like this:

@echo off
SET MYDATE=06272001
SET MYDAY=06
SET MYMONTH=27
SET MYYEAR=2001

for today's date of Jun 27, 2001.

To use this at the command prompt or in your BAT file is easy - you just run C:\MYDATE.BAT and you will have environment variables in your current session that can be used for renaming or creating files. For example:

dateset
c:\mydate.bat
ren c:\autoexec.bat c:\autoexec.%MYDATE%

This would have the effect of renaming c:\autoexec.bat as c:\autoexec.06272001


To use it in a BAT file is quite easy. Just include the following lines at the beginning
of every BAT file that you need the dates accessible:

@echo off
c:\windows\command\dateset.exe
call c:\mydate.bat

and then include the lines that do what you need to do using %MYDATE%, %MYDAY%, etc when you need the appropriate item inserted.

For example:

copy appsrv.log appsrv.%MYMONTH%%MYDAY%

To install DATESET just copy DATESET.EXE to your C:\WINDOWS\COMMAND directory so it's always in your path (under Windows NT/2000 put it in \WINNT\SYSTEM32).

----------------------------------------

DateSet and other apps of my creation are available on the website below.

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating :

----------------------------------------------------------------------
FAQId : 6238697
Subject : Incrementing an environment variable

Question : Is there a way to increment an environment variable within a batch file (or, for that matter, is there a way to do ANY kind of math funcion with DOS)?

logically, this is what I'd like to do...

SET COUNT = %COUNT% + 1

Thanks.

-Donald

Answer : The normal answer is that no, there is no way to do this in DOS.

The good answer is that I have written an app to handle this problem in DOS called Count. It allows incrementing like you want, and any other basic math function (add/subtract/multiply/divide) and can even preserve floating point (decimal) numbers too.

You can get Count and my other applications at my website below.

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating : Very helpful Paul, thanks!

----------------------------------------------------------------------
FAQId : 6284154
Subject : how do i make a "system boot disk"?

Question : How do i make a "system boot disk"?

Answer : The thing that makes a "system" disk is the presence of certain key files (and sometimes a boot sector). Those files in Windows 95/98 are:

command.com - command interpreter ("DOS")
msdos.sys
io.sys
(various assorted files not absolutely needed)

These files are usually put in place by issuing a "sys" command. For example if I have a floppy I want to make bootable I sys it like this:

C:\ > sys a:
Transferring system files...
C:\ >

Now the A: disk will be bootable. the same can be done to hard disks. You just need to be sure with either floppies or hard disks that you use the same version of DOS and a compatible copy of sys.com before "sysing" it. Whatever disk you boot from (floppy or hard disk) becomes the source for your version of DOS when you sys. So boot from the floppy, then type:

A:\ > sys c:
Transferring system files...
A:\ >

And you will have sysed the C: drive.

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities


----------------------------------------------------------------------
FAQId : 6316133
Subject : Old DOS game too fast

Question : Hi,
I have an ancient 1989 Pac-man game and not surprisingly it runs blazingly fast on my 733mHZ Celeron. How do I slow the game down?
Thanks,
-Dan

Answer : Grab the utility MoSlo - it will slow your PC down so the game plays correctly:

http://www.google.com/search?q=moslo

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Answer : Bremze is another that is purported to be able to slow even the fastest machines:

http://ansis.folklora.lv/

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating : Thanks

FUQuestion : Hi,
I tried MoSlo, and its a lot slower, but even if I set the speed to 1% original, its still too fast. Got any other ideas?
Thanks,
-Dan

----------------------------------------------------------------------
FAQId : 6609893
Subject : writing a batch file

Question : hopefully someonecan help,

whats the syntax for a batch file that will....

1. ask a user for a file name
2. ask where to copy it to
3. copy file and confirm it was done

TIA LeV

Answer : You just said more than you know. DOS has no facility natively to allow freeform user input like you describe. Many have died trying. ;-)

To the rescue is a nice little utility that can get user input and put it into a variable for your use in copying.

http://www.dosbin.com/batch01.htm#inputrel

After you copy the file you can use the form:

if exist x:\whereever\newlocation\copiedfile goto success

to determine whether the file made it to the destination or not.

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating : thanx for that maybe i should stick to using unix and perl!!

----------------------------------------------------------------------
FAQId : 6865113
Subject : Writing dos batch files

Question : I want to write a batch file that uses a part of itself only if a variable has a certain content. If I simply enter into a batchfile

dir %1 /s

for instance, then the input to run the batch file at the prompt would be

batname searchterm

and it works fine. BUT, if I want to make the switch a variable it would look something like this

dir %1 /%2

and the prompt input would look like this

batname searchterm s

and IN THEORY it would work fine. BUT, if I want to use that batch file to run a search WITHOUT any switches, then it doesn't work, because it still puts in the slash. Example

batname searchterm

when using the batch code

dir %1 /%2

will produce

dir searchterm /

and screw up because of the erroneous /.

How can I set up my batch file such that it only puts in the / if there is a variable to follow it? Better yet, how can I tell the batch file to return some kind of an echo message if a variable's content is wrong? Is this even possible?

Any help would be much appreciated.

max@nerc.com

Answer : You can check for the second parameter like this:

@echo off
if '%2' == '' goto noparam
dir %1 /%2
goto exit
:noparam
dir %1
:exit

If the second parameter spot is empty you will perform the normal dir command; if it's not empty you will use the value there.

As for checking for legit values, you can do so with successive tests as above. For example let's say that only "a", "b" or "c" are to be accepted as valid entries for the second parameter position. You can then validate the input as follows.

if '%2' == 'a' goto valid
if '%2' == 'b' goto valid
if '%2' == 'c' goto valid
goto error
:valid
dir %1 /%2
goto exit
:error
echo You need to enter a second parameter of a, b, or c!
:end

*Any* successful test above short-circuits by jumping to the "valid" branch. If it gets past all the tests of valid parameters without a match then the error code will be executed. Be aware that you may want to test for BOTH lower and uppercase letters, like:

if '%2' == 'a' goto valid
if '%2' == 'A' goto valid

Have fun!

--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities

Rating : Thanks Paul! Really great, helpful answer.

----------------------------------------------------------------------
FAQId : 6980596
Subject : Batch file

Question : Hello all batch file gurus...
I collect text files in a directory. Periodically I need to append all these collected .txt files to a single master file. What I'm trying to do is come up with a batch file that will (1)append all collected .txt files to the master file (2)not overwrite files already in the master file (3)erase the collected .txt files from the directory. I've dinked around with the DOS command line "copy file1.txt+file2.txt+file3.txt c:\whatever\master.dat" Just don't know enough about batch programming to do the same thing with a batch file.

Any workable help will be appreciated.

Answer : In this instance we need to do more than one thing to each file in the directory - the first thing is to concatenate (append) it to the master file, and the second thing is delete each file as it's handled. So we need two BAT files in addition to the "for" command. We start with TEST.BAT, which will process all the files (I'm assuming TEST.BAT and NUKE.BAT are in the same directory with the text files - if not just put the full paths on each command, or a CD command at the beginning):

TEST.BAT

@echo off
for %%i in (*.txt) do call c:\windows\temp\test\nuke.bat %%i
ren newfile newfile.txt

Notice we use the "call" syntax since we need to execute a second BAT file from within the first. We also pass it the current filename as we run it.

Now here is the NUKE.BAT BAT file:

NUKE.BAT

@echo off
echo Got parameter %1 in nuke.bat
type %1 >> newfile
rem del %1

The "echo" line is for debugging and can be removed if you like silence. Also remove the "rem" from the last line to have it actually perform the delete of each file after it's been appended.

Note that after TEST.BAT has processed all the files through the for loop that it renamed the file NUKE.BAT was using the whole time as the repository for the files (which was avoiding using a .TXT extension since it would then be included in processing!) from NEWFILE to NEWFILE.TXT, completing the migration of the text from all the text files residing in the directory to this new text file. The file doesn't have to be new either, you can easily be appending to a continuous master file that doesn't even need to be in this directory; just change the path to NEWFILE in NUKE.BAT:

type %1 >> c:\wherever\masterfile.txt


My files in the beginning were 1.txt, 2.txt and 3.txt which contained the following:

C:\WINDOWS\TEMP\test>type 1.txt
sdafasd

C:\WINDOWS\TEMP\test>type 2.txt
zxsdds

C:\WINDOWS\TEMP\test>type 3.txt
dsgasagrwe

After processing, newfile.txt contains:

C:\WINDOWS\TEMP\test>type newfile.txt
dsgasagrwe
sdafasd
zxsdds

--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities



Rating :

----------------------------------------------------------------------
FAQId : 7008112
Subject : Testing memmory in dos...

Question : Hello paul,

can you please tell me how to test the computer's
main memory in the dos mode? Also, do you know of
any good Dos program that I can use to test the
memory for damage or defects?
thanks a lot for your help...!
sammy. ;-)

***

Answer : There are some memory testers here - I'm not sure which are the best. My favorite way to test RAM to see if it is what is causing problems is to:

Create a RAM drive using RAMDRIVE.SYS or similar that is the total size of the installed RAM minus about 512K-1MB (for your running DOS). Then once I've booted with that RAM drive configuration I then do an:

xcopy c:\*.* x:\*.* /e

to copy the entire C: drive to the RAM drive. Of course it will fill up in short order and abort, but that's just what you're looking for - a *clean* abort. If the system just crashes or hangs your RAM is likely suspect. If it gracefully tells you how dumb you are for trying to copy your hard disk to your RAM and allows you to "Abort, retry, fail" then your RAM is likely OK.

This was an even better diagnostic for the system I devised this test for - the Amiga - since it had a dynamically-allocating always-available RAM: device that only took up as much room as what was in it. It was nice for this test since the copy would literally fill all available RAM not currently occupied with running code, unlike this one that neglects testing under the 512K or 1MB barrier. Nonetheless this is a good way to test your RAM as chances are good (31/32 on a 32MB system and increasing as the size of your RAM increases) that the error is not present in that lowest 1MB of RAM.

--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities

Rating :

----------------------------------------------------------------------
FAQId : 7125902
Subject : Detecting windows under dos...

Question : Hello paul,

Is there a dos command that lets you know if the
windows operating system has been loaded, or the
machine still in dos mode?
thanks a lot for your help...!
sammy. ;-)

***

Answer : One way is to look for the presence or absence of a variable that should only exist if Windows is loaded and running. The variable is WINDIR and if it exists it contains the path to the Windows directory. You can test for it similar to this (adapt the access to the environment variable's value for the language you're using):

@echo off
if "%WINDIR%" == "" goto dos
echo Windows is running...
goto exit
:dos
echo Pure DOS is running...
:exit


--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities

Rating :

----------------------------------------------------------------------
FAQId : 7501808
Subject : Passing results of a dos command to another command

Question : I want to use the find command to extract a part of another command, but I want the result of this find command to be used as a parameter for another command.

So what I want is something like this
command1 | find "string" -> and the result of this command needs to be passed to a second one:
command2 result

Can anyone help?

Answer : What you want is not achievable with straight DOS. You may try using my utility Recurse to assist you, however. You can store the results from the first part to a file:

command1 | find "string" > c:\temp.txt

And with the second line of the BAT file call recurse to deal with the resultant item(s) in the temp.txt file:

recurse c:\2ndcmd.bat c:\temp.txt

and 2ndcmd.bat would contain simply this:

@echo off
command2 %1

If you expect multiple entries from your initial "command1 | find" commands use the concatenation operator to add all of them to temp.txt:

command1 | find "string" > c:\temp.txt
(some other functions, or perhaps your command1 gets run multiple times within a 'for' loop)
command1 | find "string" >> c:\temp.txt
command1 | find "string" >> c:\temp.txt
command1 | find "string" >> c:\temp.txt

Note the first one is the standard output redirection - doing this will ensure that only fresh data is in the file as this first usage will empty the file before putting the result in it.

Recurse and other tools of my design are on my webpage below.

--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities



----------------------------------------------------------------------
FAQId : 7910077
Subject : How do I create variable names in a dos batch file ?

Question : I have a batch procedure that copies all files changed since a certain date into a zip file named george.zip :

c:\incrbkup\pkzipc -add -dir=root -aft=05-05-2002 c:\incrbkup\GEORGE.zip c:\*.*


Each time I execute this procedure, I want to change the zip file name as follows:
1st use ------ filename is GEORGE1.zip
2nd use ------ filename is GEORGE2.zip
3rd use ------ filename is GEORGE3.zip
... now recycle through those same names
4th use ------ filename is GEORGE1.zip
5th use ------ filename is GEORGE2.zip
... etc..

How can I do this ?


Answer : Here's an example I just wrote to test:

@echo off
d:\winnt\system32\count.exe
call c:\count.bat
if '%COUNT%' == '5' goto equals5
goto end
:equals5
echo COUNT is 5
:end

Running test.bat successively results in the output (on the run when COUNT equals 5):

COUNT is 5

Answer : For your purposes you would perhaps be doing something like this:

@echo off
d:\winnt\system32\count.exe
call c:\count.bat
if '%COUNT%' == '4' goto equals4
goto end
:equals4

REM next line resets COUNT by deleting c:\count.bat
del c:\count.bat >nul

REM We then can re-run count.exe to start the count again
d:\winnt\system32\count.exe
call c:\count.bat

REM Now count is back to 1 and can be used
:end

Answer : You can use my free utility Count to do this - it allows you to perform arithmetic in DOS batch files. There is a count.txt file in the ZIP that fully explains how to use it.

http://ped.deadartists.com

--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities

Rating : Wonderful! Thank you very much! Quick and simple.

FUQuestion : Paul,

This looks like exactly what I need. Thank you.

I have one question. Can I check when COUNT = 4 and then reset it to 1 so that I get only the number 1, 2 and 3 to append to my backup file name ? (your example is exactly what I want to do).

I don't now how to do the check ??

Thanks again.

----------------------------------------------------------------------
FAQId : 8117516
Subject : Batch file problem

Question : Hi ,

i need to write a batch file for school
but i couldnt get a thing right
i wrote a autoexec.bat file with a menu in it
you could choose if you want to go to windows (95) or dos after some trouble i got that working but what the next assigntment is is that if you go to the dos prompt it also needs to load a new menu where should be 3 functions in it (lotus ,dbase,and wp5.1 ) but i cant get it running right because if i click dos it FIRST should load command.exe and then go to the new menu but can't get it right is there someone who can help me? in this file down here there is no command.com fixed in it only switches between menu

http://www24.brinkster.com/gswfl/autoexec.txt

that is my "Test" plz dont watch the way i use error levels ;-) and only fix that if i press dos it loads c:\windows\command.com and than goes to the new menu with lotus

i would thank you VERRY VERRY VERRRRY much :)

Greets Erik (from holland)

Answer : You're quite welcome! I'm glad I could help.

Answer : OK I've got you fixed up, and I've enhanced it a lot (maybe too much). The version I've written based on yours is below. Some observations on your version:

1) You had the mode commands at the bottom, where they would never be run since you were looping back up above in the file in all cases. Solution: I moved it to the top, before the start label, so it gets run once (and only once) before execution really begins.

2) I changed the syntax of your "choice" command. You had this for yours:

choice:/c12

which is really not accurate. All DOS commands should come first, followed by a space, and then the optional switches/parameters. In your case you had no space and miswrote the parameter.

The correct form of yours is:

choice /c:12

I added some features to it if you'd like to use them and ended up with this:

choice /n /t:1,15 /c:12 Keuze:

"/n" disables the printing of the choices - they're in the menu so you don't need to print them again - this makes for cleaner output.

"/t:1,15" sets a time limit (in this case 15 seconds) for the user to make their choice, after which time the default choice (in this case menu option #1) is chosen for them. This is a good way to have a menu appear and have it default to enter Windows after a given number of seconds.

"/c:12" is the correctly-written form of what you had originally. This defines allowed values from the user.

"Keuze:" is the prompt will see below the menu

Note also I added the line:

echo.

just after the menu draws but before the user is prompted. This draws a blank line and is useful for making things neat.

3) I changed the Windows section a bit, having it echo a "Starting Windows now" type of message instead of actually launching Windows for easier testing. Also notice that I changed it to goto "end" (a new label I added at the bottom) instead of "start" since once you're inside Windows your BAT menu won't reappear anyway (it may after you exit Windows but I'm not sure about that - if it does then change this back to "start").

4) I'm not sure what you meant by "that is my "Test" plz dont watch the way i use error levels ;-)" but your ERRORLEVEL tests in the second menu were wrong. You need to check errorlevel in reverse order, starting with the highest number first. Note that I added a 4th menu option, 'Return'. This will allow the user to come back to the "Windows/DOS" menu from the application menu.

5) Notice the lines:

echo Running WordPerfect... hit ENTER to continue
pause >nul

These will send a message to the user about what app they've chosen to run, and wait for them to press ENTER before continuing. The second line is what pauses execution until they press ENTER. By default "pause" will put a message to the screen similar to what we stated in the line above (without the WordPerfect portion we need, obviously) but wince we're redirecting standard out to nul it's not seen. This is a clean way to pause execution, while displaying the message you want.

Finally I changed some of your multilines like this:

cd\
cd windows

to this:

cd \windows

It's important to understand that root (\" means root whether it's by itself (cd \) or whether it's at the beginning of a path (cd \windows).

I hope I haven't helped too much, but I can't leave something like that alone once I start on it!

Good luck!

--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities




@echo off
mode con codepage prepare=((850) C:\WINDOWS\COMMAND\ega.cpi)
mode con codepage select=850
keyb us,,C:\WINDOWS\COMMAND\keyboard.sys

:start
cls
echo IIIIIIIIIIIIIIIIIIII¯
echo § Menu §
echo IIIIIIIIIIIIIIIIIIIII1
echo § §
echo § §
echo § 1. Windows §
echo § 2. Dos §
echo § §
echo § §
echo EIIIIIIIIIIIIIIIIIIII¬
echo.
choice /n /t:1,15 /c:12 Keuze:

if errorlevel 2 goto dos
if errorlevel 1 goto windows

:windows
cd \windows
rem win
rem commented out the line above so we don't actually go to Windows while testing
echo You chose Windows!
rem goto start
rem Here, I would go to end instead of start since Windows will be loading
goto end

:dos
cls
echo IIIIIIIIIIIIIIIIIIII¯
echo § Menu §
echo IIIIIIIIIIIIIIIIIIIII1
echo § §
echo § §
echo § 1. WP 5.1 §
echo § 2. DBASE IV §
echo § 3. LOTUS §
echo § 4. RETURN §
echo § §
echo EIIIIIIIIIIIIIIIIIIII¬
echo.
choice /n /c:1234 /t:4,30 Keuze:

if errorlevel 4 goto start
if errorlevel 3 goto LOTUS
if errorlevel 2 goto DBASE
if errorlevel 1 goto WP

:wp
echo.
echo.
echo Running WordPerfect... hit ENTER to continue
pause >nul
cd \wp51
wp
goto dos

:DBASE
echo.
echo.
echo Running DBASE... hit ENTER to continue
pause >nul
cd \DBASE
dbase
goto dos

:LOTUS
echo.
echo.
echo Running Lotus... hit ENTER to continue
pause >nul
cd \lotus
lotus
goto dos

:end
echo.
echo.
echo Exiting...
cd \
Rating : EXELLENT!!! keep up the good work

FUQuestion : maybe i cant say it :) but i love ya :) only had to change a little bit (you typed it english and i am dutch :) and if you typed dos you were going to the menu but... i changed it to dos menu
and i will make a diiferent DOS so you REALLY could go to dos but i really thank you for this and i will rate your answer ofcourse *****

----------------------------------------------------------------------
FAQId : 8145688
Subject : wipe your hard drive

Question : Hi,

i found this site on the internet

http://www.gnujobs.com/Articles/14/Wipe_It.html

is there any possibility to make something like that in a batch file?

greets erik

Answer : Here's one I wrote to wipe the data (below). It works by writing data over the top of your deleted data, making it less likely to be retrievable. If you want to really be sure you should format and then run this until the drive is full, and perhaps repeat a time or two if you're really paranoid about making sure the data is non-recoverable.

@echo off
REM This program will overwrite free space on your hard disk by creating very large files.
REM DOS and Windows have a single-file limit of 2GB usually so if your drive is large
REM you will need to run this more than once to create
REM enough files to fill all the space on your disk.
REM Make sure you've deleted as much data as possible - the best case
REM being that you've formatted the disk and booted from floppy
REM before running this utility (copy the BAT file to C: first before running,
REM and make your current dir C:\
REM
if exist bs9.txt ren bs10.txt
if exist bs8.txt ren bs9.txt
if exist bs7.txt ren bs8.txt
if exist bs6.txt ren bs7.txt
if exist bs5.txt ren bs6.txt
if exist bs4.txt ren bs5.txt
if exist bs3.txt ren bs4.txt
if exist bs2.txt ren bs3.txt
if exist bs1.txt ren bs2.txt
echo Please enter some text (a few lines worth)... when done hit CTRL-Z and hit ENTER
copy con bs.txt >nul
echo.
echo Now erasing your drive by wasting space at a phenomenal rate...
type bs.txt >> wasted.txt
:start
type wasted.txt >> wasted.txt
goto start


--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities


Answer : Oops - I used "bs.txt" examples above, which were what I used in testing. That section is not real useful so just rename "c:\wasted.txt" to something else after each run:

c:
ren wasted.txt wasted1.txt

for instance. Then run the BAT file again and ren again:

c:
ren wasted.txt wasted2.txt

until you've used all your available hard disk space.

Another note - you'll know each run is complete when you start getting messages about being out of disk space - that's when you'll need to hit CTRL-C to stop that run and rename.

PowerUsers.info - Paul Doherty Askme Archive of Questions and Answers

Return to AskMe Archive Main Page

Return to Main PowerUsers.info Main Page