batch or command file help

I need to search my whole computer in all folders for these files and delete them. I'm trying to make a command file to automate the process. The commands below will do one drive.

I'd like to improve this batch file by prompting for which drive to clean. Any suggestions?

cd\ del /s DMC32.DLL del /s DMCBUS32.DLL del /s DMCGC32.DLL del /s DMCNET.EXE del /s DMCNET.TLB del /s DMCPAR32.DLL del /s DMCREG.OCA del /s DMCREG.OCX del /s DMCSER32.DLL del /s DMCSHELL.OCX del /s GLWDMISA.INF del /s GLWDMISA.SYS del /s GLWDMPCI.INF del /s GLWDMPCI.SYS

Reply to
Karl Townsend
Loading thread data ...

You would be better off in the long run, if you installed cygwin and used bash for scripting.

i
Reply to
Ignoramus17332

I'm not sure how to prompt for an input, but you can pass a parameter when calling up the .bat file.

formatting link
example: C:>del_crap.bat C

Dave

Reply to
spamTHISbrp

If this is just a one time thing why not use Windows File Manager/Find function ("Window Key+f")? It can find stuff using wild cards. Maybe try something like "dmc*" and see what all comes up with. Then try "glwdm*". Hold down your control key and click on each file found to highlight. Then hold shift down while tapping the delete key if you really want them gone and not just in the recycle bin.

Reply to
Leon Fisk

No, I end up doing this at least twice a year. AND, everybody that owns Camsoft ends up doing it, at least occasionally. I want to offer a script to the Camsoft newsgroup. Iggy's suggestion is a second choice because you'd have to download and install software just to run the batch file.

karl

Reply to
Karl Townsend

Do they always end up in the same directories? If so, 'Brute Force Uninstaller' lets you write a script to do the job.

formatting link

Reply to
Michael A. Terrell

Change dos prompt to drive you want to clean.

Execute command using full pathing. Drive:\directory\filename.bat

Basic dos.

Wes

-- "Additionally as a security officer, I carry a gun to protect government officials but my life isn't worth protecting at home in their eyes." Dick Anthony Heller

Reply to
Wes

Don't want to wait until my post shows up. If these are unique file names, make a script that cycles though drives c-z. Deleting stuff on drives that don't exist will not cause you problem.

C: Call your delete script D: Call your delete script . . .

I might be wrong, iirc, call causes a basically subroutine jump. If Command Extensions are enabled CALL changes as follows:

CALL command now accepts labels as the target of the CALL. The syntax is:

CALL :label arguments

A new batch file context is created with the specified arguments and control is passed to the statement after the label specified. You must "exit" twice by reaching the end of the batch script file twice. The first time you read the end, control will return to just after the CALL statement. The second time will exit the batch script. Type GOTO /? for a description of the GOTO :EOF extension that will allow you to "return" from a batch script.

I'm rusty so you may need to do a bit more research.

Nighty night,

Wes

-- "Additionally as a security officer, I carry a gun to protect government officials but my life isn't worth protecting at home in their eyes." Dick Anthony Heller

Reply to
Wes

del /s dmc*.* del /s glwdm*.*

Reply to
Tom Gardner

...

This takes the baby (files you need) out with the bath water. Looks like there's not a better way than to search with the above criteria and then select files to delete.

Karl

Reply to
Karl Townsend

Karl,

I'll have to take a look at my old references. It has been too long since I last made a slightly complicated bat/cmd file. My old 386 machine has the more tricky examples on it. I'll get back to you on it if someone here doesn't come up with a good solution first :)

It keeps my brain going messing around with stuff like this.

Reply to
Leon Fisk

If camclean.bat is in your path you can do something like this:

%1: cd\ del /s DMC32.DLL del /s DMCBUS32.DLL del /s DMCGC32.DLL del /s DMCNET.EXE del /s DMCNET.TLB del /s DMCPAR32.DLL del /s DMCREG.OCA del /s DMCREG.OCX del /s DMCSER32.DLL del /s DMCSHELL.OCX del /s GLWDMISA.INF del /s GLWDMISA.SYS del /s GLWDMPCI.INF del /s GLWDMPCI.SYS pause exit

Then start the command with something like "camclean g". This would switch to drive D:, go to the root directory and then run your list of commands, pause to see what happened and then close the prompt window hitting any key. Remove the "exit" if you want the window to stay open for more use.

If you forget to feed it a drive letter it will just do the current drive where the batch file is located.

I've got some other ideas, but I haven't tested them yet. The problem with batch files is getting user input into them. Locating the old Choice.exe and using it can work with multiple choice questions, otherwise it gets messy.

Reply to
Leon Fisk

On my computer that would kill Delorme Topo 2.0, Autocad, Street Atlas USA

2006, some windows system stuff, and some cygwin stuff.

Wes

Reply to
Wes

Here is one solution I came up with, but you will need to get a copy of Choice.exe and put it in your path somewhere (you might already have a copy). This program used to come with older versions of DOS, only comes with the Resource kits now. You can get several versions in a bundle here:

formatting link
Change your batch file to the following text in between the equal signs:

=== @ECHO OFF choice /Ccdefgh0 Choose drive letter to clean or 0 to abort IF ERRORLEVEL 1 SET ERRORLEV=c IF ERRORLEVEL 2 SET ERRORLEV=d IF ERRORLEVEL 3 SET ERRORLEV=e IF ERRORLEVEL 4 SET ERRORLEV=f IF ERRORLEVEL 5 SET ERRORLEV=g IF ERRORLEVEL 6 SET ERRORLEV=h IF ERRORLEVEL 7 GOTO END

%ERRORLEV%: cd\ del /s DMC32.DLL del /s DMCBUS32.DLL del /s DMCGC32.DLL del /s DMCNET.EXE del /s DMCNET.TLB del /s DMCPAR32.DLL del /s DMCREG.OCA del /s DMCREG.OCX del /s DMCSER32.DLL del /s DMCSHELL.OCX del /s GLWDMISA.INF del /s GLWDMISA.SYS del /s GLWDMPCI.INF del /s GLWDMPCI.SYS pause

:END exit ===

You could edit/add a couple more drive letters if you wish. I think the code is pretty self explanatory. You can get a list of parameters for Choice by entering "Choice /?" at a command prompt. It is a really simple little program.

See if that does what you want.

Reply to
Leon Fisk

THANKS for your help.

Karl

Reply to
Karl Townsend

A bit late here, but if you can locate a copy, 'DOS Batch File Power' with the Jamsa Batch Utilities disks by Kris Jamsa is sort of a bible of batch file programming. I've not really used it myself, but gave a copy to my brother who is something of a guru. He was actually impressed with it and used a number of techniques.

Don't know if it covers exactly what you want to do, but it's worth hunting down for anyone still playing with .bat files.

Jon

Reply to
Jon Anderson

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.