Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

5301.

Solve : Playin with time?

Answer»

Hi all.

I need help creating a batch that will, on an XP system;

1. GET the current time
2. determine if time is in 12 or 24 hour format
3. convert to 24 hour format if needed
4. enter the current time + 1 minute into a command line; eg, if it's now 8:54 PM, the time entered into the command would be 20:55


get current time
determine format
convert to 24 hr where needed
add 1 minute to the current time of 20:54
at 20:55 START notepad

TIAwww.homeworkhope.comThanks GX1_Man, but that URL won't resolve for me. Me either. I know if you put %time% into the bat file it will show the time. Don't know about the rest.Unless you're prepared to write a boatload of IF statements, batch code is not the best solution. Try using any of the Windows scripting languages (VBScript, JScript, Perl, Rexx, Python etc) which have functions for processing DATES and times.

The Windows 2000 Scripting Guide may help get you started.

Good luck. 8-)Thanks Sidewinder,

I actually found a utility called Errtime that will return hours in 12 or 24 ERRORLEVELS, and minutes in 0-59 errorlevels. Using that and the following format, I was able to get the job done.

errtime -h
if errorlevel 23 goto hour23
etc etc through to errorlevel 0

:hour23
errtime -M
if errorlevel 59 set (a=00) else (set a=23)
goto minutes
etc etc through to errorlevel 0

:minutes
errtime -M
if errorlevel 59 (set b=00)& goto done
if errorlevel 58 (set b=59)& goto done
etc etc through to errorlevel 0

:done
at %a%:%b% notepad


Does involve a few IF statements, but not a problem.
Javascript would be quite an easy way to go about this one!!

5302.

Solve : missing file problem?

Answer»

Hi Folks....I'm new and naive! After years of success with my old Dell Inspiron 3500, I booted it up the other day and it immediately went into DOS with the following ERROR message: "VMM32.VXD required to run Windows." I did a directory search and found the file in the C:\system directory. I thought it might be corrupted, so I tried to delete it in hopes of then reloading the Windows 98 OS and solving the problem. However, when I tried to delete the file, I got a "file not found" message. I then tried reloading the OS anyway, but it woudn't run and I got the same original error message. In summary, Windows doesn't recognize the file, it IS in the C:\system directory, but I can't delete it. Any thoughts? Thanks, in advance, for any consideration.
LarryHi again...As a follow-up, I managed to delete the "vmm32.vxd" file. When I tried to reinstall the Windows 98 OS, it stopped soon after it started with the message that Windows 98 was already installed and that I would have to install "windows 98 update" I tried that and it went to DOS with the same "no vmm32.vxd" message. I'm trying to resolve this without having to reformat the hard drive. To summarize, MS support says that if the vmm32.vxd file is not on the drive, I must re-install Windows 98. When I try to reinstall the OS, it won't install because it says I already have 98 installed. Hi

chances are your install CD is windows 98 Service PACK 1 or 2.
the version on the computer may be older or newer so it will freak out and ask for the same version, ie w98sp2 installed you need win98sp2 disk.
possible that it was plain win98 and was updated to sp 1 or 2 later, maybe from a magazine cd or something.
Anyhow you need the same version if you don't want to reformat

OR

the vmm32.vxd file will be on any windows CD but it may be zipped in one of the .cab files.
If you can find it you can extract that single file and copy it over on floppy disk.
BUT .... same goes here, if you currently have win98, SP1 or sp2 installed you will need same version.
hope this helps
steveDo you have a full version cd of Win.98 and the product key and a diskette drive:-? If so do a Repair install of Win.98 Post back if you need instructions..

Good luckDusty and Steve....Thanks for taking the time to respond. I found a Dell Diagnostic disc that came with my computer. I ran it, and it said the hard drive is shot. So, I think I'll let this sleeping dog LIE! I might try a reformat just for drill. Once again, thanks for helping!You're WELCOME Cloudrest - sorry to hear about the demise of your hdd...

Good luck

5303.

Solve : commands for Batch file to enter strings?

Answer»

HI Guys!!!

Can somebody please let me know the code or COMMAND that I need to use in order to write a BATCH file which can be used to edit a file in such a way that some WORD strings can be addded to the already existent file and the same gets saved.

ThanksYou can APPEND lines to an existing file: echo dataline >> filename

You can launch an editor from a batch file: notepad and manually make changes

You can launch an editor from a script and script the edit actions. (need SPECIFIC editor info)

8-)

5304.

Solve : how to use batch file as a background process??

Answer»

Hi, How can I make a batch FILE that will execute some process that is not visible, in the background ?You COULD try running your application as a service. Check out SRVANY

You could also use start /min programname HOWEVER the START command will PRODUCE a taskbar entry

Keep in MIND in no process is truly invisible; some just more so than others

5305.

Solve : how to copy files from one pc to another pc in dos?

Answer»

hi,
I want to transfer files from one pc to another pc. how do i do it USING COMMAND line. should the pc's be connected in any means. please find me any dos commands which do help to copy files from pc-to-pc.
Thanks.Please read this

We can only advise you about things referring to [highlight]your[/highlight] pc but you don't tell us what you've got [smiley=dankk2.gif]I couldn't have said it better myself.

Wait, I did say that! look for a freeware or other wise VERSION of Laplink or a derivative.
if you r not sure what it is google it.
This will do what you want.
but.....
the easiest & quickest way is to put one HDD from one pc into the other PC so it has two HDD's and copy the stuff over

when you say commands do you mean stuff like ??

copy c:\*.* d:\

if you are not sure what this means I dont mean to be impolite but maybe you should not try to do this.
but if you want to try, post back & i will try to help
steveHmmmm - Laplink or Interlink or another Dos based prog :-? The O.P. mentions 'command line', maybe, just maybe, he really means Command Prompt so could be running any of the NT OS's and his pc's might not have such beasts as Parallel or Serial ports just simple Usb.

Perhaps we should await his clarification, unless he's ALREADY gone off and invested in a null modem cable or similar. [smiley=lolk.gif]

5306.

Solve : Batch to close window?

Answer»

Hi

I am a TOTAL batch n00b so be easy on me!
I have a batch file that will open some mapped drives on a computer.

The format is simple:
start G:\
start H:\
start I:\
start J:\

The batch works OK so far, but I am left with these windows open. Is there some more code I can put on the end that will close the windows and return to a clean desktop?"exit" CLOSES cmd windows

uliI don't need to close the cmd window, that closes automatically.

I mean I need to close the Explorer window, the one I opened with the batch file in the first place!

in other words, G:\ window contents is now open, I want to close it with a batch command.Oh.
Killing the explorer task might be an option. "kill".
Why do you open the explorer? Is there no way to avoid it?
Dumb question I know, but...

uliYou would need to send keystrokes to each of the open windows. Batch coding cannot do this, but VBScript can:

Code: [Select]Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "[highlight]Window Title[/highlight]"
WScript.Sleep 100
WshShell.SendKeys "{F4}"

The highlighted area contains the Window title NOT the executing program name which presumably is explorer. You can repeat the last THREE statements as needed.

After saving the script with a VBS extension, run with cscript scriptname.vbs

There is also a program called AutoIt that can be helpful in this SITUATION but VBScript is already installed on your machine.

8-)

5307.

Solve : To count the no.of lines in a text file?

Answer»

Hi,

I have many source text files and I would LIKE to count the no. of lines in each text file. My output text file should contain the source text file name and the count of rows in each source file.

The operating system is 'Microsoft Windows XP'....

Plz help in doing this..

Regards,
Moorthy.Try this
find /v /c "" filename

---------- filename: 166

however it will not count lines that are truly blank, so PUT some long RANDOM string into the quotes that you know will not appear in the file

GrahamThanks for your suggestion!! But is there any other possible way to do this? Since, in this case some of the blank lines MAY be omitted in counting.

Regards,
Moorthy.Hi,

I got one more command for doing this.

wc

For getting line count in a file,
wc -l

For getting word count in a file,
wc -w

For getting character count in a file,
wc -c

Note that the character count includes garbage values...

Regards,
Moorthy.It might be easier to use a script where you can count line feeds/carriage returns.

Code: [Select]Const ForReading = 1

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("[highlight]c:\scripts[/highlight]")
Set fc = f.Files

For Each fs In fc
If UCase(fso.GetExtensionName(fs)) = "TXT" Then
Set objFile = fso.OpenTextFile(fs, ForReading)
strText = objFile.ReadAll
objFile.Close

arrWords = Split(strText, vbCrLf)
Wscript.Echo fs & " " & Ubound(arrWords) + 1
End If
Next

After saving the script with a VBS extension, run as cscript scriptname.vbs

Change the highlighted text for your local machine. Script presumes all the TXT files are in the same directory.here's a Python script you can use in Windows as well as Unix.

Code: [Select]f = open("test.txt").readlines()
PRINT "Number of lines in test.txt is %d" % len(f)

5308.

Solve : Batch File Tidying up?

Answer»

ok Ive created a batch file that checks that Oracle services on a server are running and it works

but when i run the batch file I get all the batch code too

EG my output is:

C:\>SC \\dbscm1 query OracleServiceORACLE1 | FIND "STATE"
STATE : 4 RUNNING

C:\>IF ERRORLEVEL 1 (
echo OracleServiceORACLE1 Not Running
PAUSE
) ELSE (echo OracleServiceORACLE1 Running )
OracleServiceORACLE1 Running



When All I want is:

"OracleServiceORACLE1 Running"


Heres my code

Any Suggestions?

SC \\dbscm1 query OracleServiceORACLE1 | FIND "STATE"
IF errorlevel 1 (
echo OracleServiceORACLE1 Not Running
PAUSE
) ELSE (
echo OracleServiceORACLE1 Running
)

Thanks Graham



HEY I got this working!

echo off..... (whoops my bad)

but if anyone knows how to CHECK what processes are running on a machine using a batch file, could they please tell me how.

thanks

Grahamyou can USE pslist from SYSINTERNALS, or tasklist

5309.

Solve : Batch Files to Check Services on local Machine?

Answer»

I wish to create a batch file that will check if a service is running on my machine (namely OracleOraHome92TNSListener).

I have no IDEA how to do this as I only have a very basic understanding of MSDOS

if ANYONE could show me a solution or at least point me in the right direction. that would be great!

thanks GrahamUse the "sclist" COMMAND from the [RK]

Something like this should do it:
set service=name of the service you want to check

sclist | findstr /i %service%| findstr /i running
IF %ERRORLEVEL% EQU 0 (echo %service% running)
IF %ERRORLEVEL% NEQ 0 (echo %service% is not running)


hope it helps
uli

I dont understand what [RK] means.
As I mentioned I have a very limited knowledge of MSDOS (im PROBABLY attempting to bite off way more than i can chew here)

I should have also mestioned that my OS is windows XP Professional Version 5.1.2600

sorry!

I tried to create a similar program in .NET but to no avail

Graham[RK] means Ressource Kit.
Maybe "SCLIST" is standard in XP. In NT4 it is in the [RK].

hope it helps
uli

5310.

Solve : Schedule upload file with different name?

Answer»

Just created a batch file for DAILY BACKUP,

pscp -pw password -r "c:\Program Files\backup.txt" [emailprotected]:backup.txt

but can the filenames AUTOMATICALLY change daily? For example, 29/8 can have backup20060829.txt, 30/8 can have backup20060830.txt....

Thanks for HELP...

5311.

Solve : How to: create a text file from a bat?

Answer» HELLO, Hopefully this is easy for someone. What I'm trying to do is have a bat file leave a text file in the ROOT of c:\ It doesn't need to have anything in it, it just has to be there.

What we are doing is RUNNING audit software and we have the ip range check accounted for but would LIKE the process skipped if the audit has run correctly.

thanks in advance!echo >c:\done.txt

for example should do it.

hope it helps
uli
I knew it was something simple, thank you!!You can also use >> c:/Yourfilename.txt ECHO something in your file
5312.

Solve : Batch file to return ping response?

Answer»

Hello All,
Need a little help.
I am wanting to create a simple batch file to ping several known IP Addresses from within my NETWORK. I need to make this utility for my comrades at work when I am not there to FIND the problem.

I am wanting to ping an IP Address, then if it does return, state SUCCESSFUL, or if it fails, return the IP Address and a name I assign to that address, then move to the next.

Any help appreciated
Davids Learning
You can read out the pcnames from a hostlist with a for loop
to ping and analyze the output

findstr gives you errorlevel 0 if it finds the string, errorlevel 1 if it doesn't find it.
The FOLLOWING code works on my machine.
(Depends what the output of ping ins on your machine. I use german language version.

hope it helps
uli

@echo off
setlocal
FOR /F %%h IN (hosts.txt) do call :ping %%h
echo.



goto :eof
:ping
set PC=%1

REM check if PC is online.
ping -n 1 %PC% | findstr Timeout
IF %ERRORLEVEL% EQU 1 (echo %PC% >> pc_online.txt

endlocal

:EOF




I appreciate you responding, but I need to be able to ping specific IP's with a name that I assign. The pc's here do not have the users name.
The people here wont understand what the names are and where they are.
I have got to keep the response so that its simple for the others to understand.

I was wanting to return like

Timmys PC - Found OK
Tonys PC - Not Found - Problem
Internet Provider - Found - OK

The first 2 would be IP addresses
The second would be a Web Site ping

Thanks
Davis Learning
So you want just a single ip adress with names?
You need a list with all pcs like this:

Tommy:1.27.111.111
Mad:1.7.222.222
....

Use it like:
Script tommy


@echo off
setlocal
if {%1} == {} (echo please type a pc name & goto :EOF)
set USER=%1

FOR /F "tokens=1,2 delims=:" %%h in ('find /i "%USER%" hosts.txt') do call :ping %%h %%i

goto :eof
:ping %%h %%i
set USER=%1
set IP=%2

REM check if PC is online.
ping -n 1 %IP% | findstr Timeout
IF %ERRORLEVEL% EQU 1 (echo %USER%s PC -OK >> pc_online.txt
IF %ERRORLEVEL% EQU 0 (echo %USER%s PC - Not OK >> pc_online.txt
endlocal
:EOF


This should work (hopefully ;-))
Uli

5313.

Solve : REBOOTING HARDRIVE PROBLEMS?

Answer»

hi, i have recieved an old computer running windows 98, the computer is pretty much useless except i WANT to use the 20 GIG hardrive from it, and put it in my current computer. but im trying to reboot it while its plugged into the old computer and im having trouble doing so. i've tried the dos COMMAND reboot/autotest but it says the is a required perameter missing. is there an easier WAY or if not a way of fixing this.

help would be much appreciated, thanksI don't understand why you're trying to re-boot it in the old computer?
You can TEST the hard drive from a floppy & if it's OK then stick it in your new computer.

5314.

Solve : How to know if a file is "in use"?

Answer»

How to know if a FILE is already "in use" (opened) by another computer in a network?
This is very important to avoid two or more computers in a network to open and use the same DOS file at the same time.
May anyone help me?you can DOWNLOAD psfile from SYSINTERNALS. it should provide what you want.
Tank you. It can be useful, but I need to use it in a procedure (e.g. a .bat file) and I don't see how to do this.

HAve a look here http://www.sysinternals.com/Utilities/PsFile.html

5315.

Solve : bat file to run file in my network places?

Answer»

Hi everyone.

Well i have this file in my network places which i run to connect to the internet. Now i don't see an extension on it so don't know how to make a bat file point to it. How do i write a bat file to run that file so i can connect to the internet?

I have windows xp pro service pack 2. Thank you in advance for the help.Open My Computer==>Tools==>Folder Options==>View tab.

Unclick "Hide Extensions For Known File Types"

Curious: My Network Places is a SPECIAL Windows Folder. Why is your program in there and how do you access the path information in your batch file?

8-)lol thank you for the reply but i know that already. I tried that before i posted but it doesnt give me a extension. All your connections are in my network places, lan, internet etc etc. Now that icon to access the NET, i would like to write a bat file accessing that file. lets call it connecttointernet.

Its a icon above lan etc that is in network places. It has no extension that i can see, and i created a shortcut to it and that doesnt have an extension either.

Windows is windows xp pro service pack 2Quote

All your connections are in my network places, lan, internet etc etc
From your description, I suspect your TALKING about the "Network Connections" folder not My Network Places.

The Network Connections icons are not executable but rather hold the configuration for each type of connection. It is this information that programs accessing the telecommunciation features of your PC use to make their connections to the outside world or to other devices.

If you want to access a device/internet you generally start software which will be configured to use a specific connection. (Ex: IE can be configured to use a Dialup, a LAN or wireless connection). It is this software your batch file would contain a pointer to, not the connection it might use.

I'm so very confused what you're trying to do. :-?
5316.

Solve : Testing memory...?

Answer»

Hi, i am new here and i am wonderin if someone can point me in the right direction. i have to make a batch file that does the following:

Restart the computer.
Run a program.
Output results to a text file.
Then do the same thing for three more programs.

Thank you in advance for any help...Generally we try to avoid doing homework for people, but I am going to move this to the DOS section AND give yo a link to batch files. There are also many good books available, probably your textbook has some as well.

http://www.google.com/search?hl=en&q=batch+file+helpIf he is a newbe the "entrance" can be a bit difficult and timeconsuming to find.

A little starthelp:
Check the "shutdown" and the "call" command.
This Website might help: http://www.ss64.com/nt/

HOPE it helps
ulii know how to use the call and start function...but how do one restart or shutdown the computer and run the program? i know the basic shutdown comment... after one restart, does the batch file CONTINUE? Thanks for any help...use shutdown -r then autoexec to run the program!i know how to shut down and everything but DONT know how to shut down and run the program automatically once it is restarted without entering anything into autoexec. the batch file will continue to still run after the restart. can someone show me an example. thanks...When you run the bat file, it wont carry on from where it left off after the restart. Try write a bat file that inputs the values into autoexec.cfg file then deletes them if you dont want anything there.Quote

When you run the bat file, it wont carry on from where it left off after the restart. Try write a bat file that inputs the values into autoexec.cfg file then deletes them if you dont want anything there.

Huh ? ? ?


lol ok never mind i explained all wrong.You can change the registry KEYS to autologon to the pc.
(To find out the keys make a reg dump, change it with tweak ui, make a reg dump,
compare it with the fc command...)

To autostart the batch file again after the REBOOT, do it with the registry.

Change the registry back at the end of the batchfile.

The reg commmand is in the [RK].

Will be tricky and timeconsuming but...

hope it helps
uli

(I don't know the reg keys, sorry.)
5317.

Solve : how to put password for a folder in do?

Answer»

hi every one, im just a new MEMBER of this forum , i'll be greatfull if u people forgive me if i do mistake .
my question is - how can i put password for a folder in dos mode (win xp )
i SAW some1 did that in win98 , but im not sure it is possible in winxp or not .
(he put something in dos mode and in wondows i was unable to go or do anything with that folder. )
thank you ^_^ .

if i remember it correctly... you can't do this in Windows XP...

in Windows 98... you need to do the following...

type

ren current folder name new folder name(hold ATL and type 0169 on the num pad)

press Enter

reverse the method to UNLOCK...

ren current folder name(hold ATL and type 0169 on the num pad) new folder name

hope this helps u!THNX bro . ^__^ thank you very much ^__^

5318.

Solve : How to configure network on MS-DOS ???

Answer»

Hi, I'm trying to connect my old laptop (PII 300MHZ, 128MB RAM) to my desktop computer (AMD XP 2600+, 1GB RAM) by LAN. The laptop has actually MS-DOS 6.22 and desktop is running under Windows XP Professional SP2.

I've installed the network drivers for DOS and also the Microsoft Network Client Version 3.0 and Microsoft Workgroup Add-on but it doesn't seems to work. Both computers have the same workgroup but they can't see each other.

Anyone KNOWS how to configure the network? Thanks.put windows onto the p II and you should be fine. If p2 has win98 you have to add netbois to win98 and the winxp computer. Also put a ip into the tcp/ip config and it should work. That how a FRIEND of mine got mine to work.The problem is that the CD-ROM neither works so I'm trying to use network to install other OS (i.e. copying i386 folder on laptop's HD for install).If you are wanting to install XP on that machine that laptop is not going to be very happy...I'm not so CRAZY... I want to install Windows 2000 on it. Any solution for network config??Quote

I'm not so crazy... I want to install Windows 2000 on it. Any solution for network config??

Sorry bout that i saw the reference to the i386 folder and AUTOMATICALLY assumed XP...

The last time i had this dilemna i just purchased a 2.5"HDD adapter to IDE...that way you can slave that HDD onto your desktop machine and copyl away. Replace the HDD in the laptop and you should be good to go.

patio 8-)
5319.

Solve : partition won't go away?

Answer»

after installing windows 98 i realized that by accident I left a partition that takes up 177 mb on the hard drive. FDISK says it's an extended DOS partition but i'm pretty sure that it's a swap partition that I made when I installed Red Hat 7. FDISK won't DELETE it because it says something about some logical DOS drive and when I tell it to delete it it says no logical DOS drives identified. I can't delete it but I want the 177 mb because the hard drive is only 1.5 Gb.SOLUTION: get a bigger hard drive (then 177meg is very very very very small)

Edit: You said that it says extended hd, so you should have another drive letter, drive D or something. If you dont want it then try fdisk and delete all partitions and start over. Or get winxp, so much easier.are you on government control PILLS?

The hard drive is 1.5 Gb, not 177 Mb. and I tried to delete the *CENSORED* partition in fdisk but it wouldn't. next time, try to read the whole post, not half. XP wont work on this thing, it has 200 mhz pentium 1 and 16 RAM. starting over is what i did in the first place but it wouldn't delete it!!!!!Use a Linux disk and use the cfdisk utility. Like FDISK ons teroids.How do you get to a command prompt from a linux CD?lol nowhere did i say you had 177 meg big hard drive. What i meant was on a big hard drive 177 meg will be next to nothing.ive seen 2 year olds MAKE more COMPLEX sentences that made more sense than yours.Download Vector Linux and you can quickly access CFDISK before the install routine.

www.vectorlinux.com

5320.

Solve : end frozen applications using dos?

Answer»

i want to end FROZEN applications using dos prompt in windows xp. how can i do it?
is there any WAY of ending any application without using task manager because it has been locked by the administratorIf you have the Pro version of XP, try using TASKKILL (already installed). If you have the Home version, try using the kill command from the Win2000 Toolkit or using pskill from the PSTools KIT.

8-)Why don't you contact the administrator of the machine? I', sure there is a GREAT reason why you are not allowed access to this.

5321.

Solve : Files from DOS to Windows?

Answer»

I am upgrading a COMPUTER at my office. The current one is very old, has windows 95! There is a very important program with lots of important info that I need to have in the new puter. Problem is this program is in DOS format! They have newer programs for windows now, but if I purchase one of these programs (atleast $1000) will I be able to transfer the files from the old program? Or can I transfer the old program right ONTO the new puter? I am not very computer literate if you haven't noticed, so I kinda need some help.......
Thank you to anyone who has any info for me!!!! :-?What program is this ? ?

You cannot just copy a program and expect it to work...

Another option WOULD be to use a dual boot setup and install the Win95 HDD into the new machine. Cleanest WAY to do this is to check to see if the new machines BIOS supports booting from more than one drive.

patio. 8-)Hi Patio, thank you for responding...... The program is called ServMaster by CDR Technologies, who don't seem to exist anymore. It is a service program for Air Conditioning companies. We keep customers name, address, equipment model and serial numbers, and service history.

Not sure what dual boot setup or BIOS means :-/ but I appreciate your help Basically it means that when you start your computer you hit a key (mine is delete ) and then a menu comes up asking which hard drive i want to boot from...in your case since i'm assuming you are upgrading to XP your choices would be the XP hard drive or the Win98 hard drive...this would give you the best of both worlds and suit your needs.

Most newer machines have this option already in the BIOS so just find someone in your area who is knowledgeable about these things and doesn't want to charge you and they can walk you thru it in about 5 or 10 minutes...
Good Luck !

patio. 8-)

5322.

Solve : Running an .MSP Windows Installer Patch?

Answer»

Hi guys,

A few weeks ago i bought roxio 8 suite, downloaded the update and extracted it, i got a "update.MSP" file, my pc did read it but the pc of my dad didn't, so i SEARCHED the line on my pc that run it, and copied it to my dad's pc. I can't EXPLAIN it in ENGLISH cause my english is so bad so here's a screenshot:
http://home.planet.nl/~kroes247/temp/Screenshot1.jpg
i used this line:
"C:\WINDOWS\System32\msiexec.exe" /p "%1" %*
and pasted it into my dads configuration and it WORKED,

Is there any way to run the .msp file from a commandline with that line from above so that it will work in any computer?

Thanks in advance & sorry for my bad spelling!

Ruben KroesAnyone?

5323.

Solve : How to delete folders with common characters name?

Answer»

I want to delete a lot of sub-folders with files. Folders named with some common characters e.g. /foldera/200406, /folderb/200407, /folderc/200408 ...... many.
How to write a batch file to delete all of them without change directory. Is it require any for each loop ?
Pls help.Batch code has two wildcard characters that might be helpful here: * and ?

The asterisk represents a whole word or group of characters. The question mark represents a single character.

In your case something like:

del \folder?\2004??

might work.

Be very careful. Using wildcards can have unintended and disastrous results especially since files DELETED thru the command prompt do not make a side trip to the recycle bin.

8-)
Hi, thx for your ADVICE, I tried most cases as shown below.

C:\del c:\stats\?\2004??
The filename, directory name, or volume label syntax is incorrect.

C:\del c:\stats\*\2004??
The filename, directory name, or volume label syntax is incorrect.

C:\del c:\stats\*\2004*
The filename, directory name, or volume label syntax is incorrect.

but all are not working.

:-?Oops! To delete folders use:

rd \folder?\2004??

Depending on your OS, the RD command has switches which may be safer than wildcards.

Im using winxp dos command.

rd is not working also.

c:\rd c:\stats\?\2004?? /s
c:\stats\?\2004??, Are you sure (Y/N)? y
The filename, directory name, or volume label syntax is incorrect.

and same as
c:\rd c:\stats\*\2004* /s

even
c:\rd c:\stats\foldera\2004?? /s
c:\stats\foldera\2004??, Are you sure (Y/N)? y
The filename, directory name, or volume label syntax is incorrect.

It seems wildcard cannot be used.

:-?Microsoft may have overlooked the no wildcards with RD in their documentation. But there are other ways to do this. Create a set of directories matching the pattern, iterate thru the set, and pick them off one by one:

Code: [Select]@echo off
for /f "tokens=* delims=" %%i in ('dir /b /a:d c:\stats\?\2004??') do (
rd /s "%%i"
)

The above code is for use in a batch file. Using * as a wildcard may produce unexpected results.

8-)

Note: You may want to replace rd /s with echo for the first run. This will enable you to see what will be deleted before you actually delete anything.Hi,

It is not working either with same reply "The filename, directory name ..... is incorrect."

But it works only when the path is specified with exact location and run after CD to that directory, otherwise file is not found.

@echo off
for /f "tokens=* delims=" %%i in ('dir /b /a:d c:\stats\foldera\2004??') do (
rd /s "%%i"
)

Seemed that c:\stats\?\2004?? is not work. I have so many folderX. Kindly pls help solving this.

:-?


I guess wildcards can only be used at the end of a string. Best thing to do is keep plugging until you get it right but when things get to a point where you're nesting FOR statments, it may be TIME to rethink your whole approach.

In any case, this may work:

Code: [Select]@echo off
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d c:\stats\?') do (
for /f "tokens=* delims=" %%x in ('dir /s /b /a:d %%i\2004??') do (
echo "%%x"
)
)

There may be some "File Not Found" messages. Disregard, as these are folders that don't fit the naming convention.

Note: I left the echo in; change to rd /s when happy with the results.

8-)Not work. I copy batch file everywhere but just only reply the system prompt no matter where I started.

c:\
or
c:\stats\
or
c:\stats\foldera

No synthx or ERROR message ??




Actually I was able to get this code to work quite well in my test environment:

Code: [Select]@echo off
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d [highlight]c:\stats\?[/highlight]') do (
for /f "tokens=* delims=" %%x in ('dir /s /b /a:d %%i[highlight]\2004??[/highlight]') do (
echo "%%x"
)
)

The pattern (mask) may be incorrect on the DIR commands (highlighted for your VIEWING pleasure). I'll leave you to straighten that out.

Note: The question mark (wildcard) on the first DIR command refers to one and only one character. The double question marks on the second DIR command refer to two and only two characters.

Good luck. 8-)

Special note: I would not run this from a directory that might be affected by the logic. Removing the directory you're logged into may create problems.Hi Sidewinder,

It is the DIR problem. Smooth running when I change c:\stats\? to c:\stats\*.
I have deleted over 1300 folders with more than 70000 files in just 2 mins.

THANKYOU so much for your GREAT HELP.

5324.

Solve : DOS Shell?

Answer»

I KNOW, its odd that a person like me would still be running DOS 4.1, but, I still need help here.
How can I ADD a menu item that will start Windows 3.0?

I have the shell program on drive C:\ in C:\DOS\ (and then an autoexec.bat file starts it)
And Windows 3.0 is on drive D:\ under D:\Win\Win.com

I have already created a menu item. Its "Change Program" BOX shows the following:
Required
Title: Windows 3.0
Commands: D\Win\win.com
(and then the optional stuff)

5325.

Solve : continuing bat file after restart?

Answer»

hi there...is there a way where I can run a bat file which shuts down the computer then continue running the bat file after it restarts? i've search HIGH and low and still cant find the command or procedure to do it. thanks for any help.Not directly and not easily. The computer remembers remarkably little from boot to boot.

On a windows machine, you'd need two files. The first would update the runonce registry key with a reference to the second file, then reboot the system. The second would be the file containing the commands to run after the boot.

For more details: Run Once

reg /? at any command prompt

On a MS-DOS machine, you'd need a file to update the autoexec.bat with the commands to run after the boot, then reboot the machine. After the boot, the autoexec will run the commands you requested.

Note: the autoexec approach is an every time thing, your commands will run after every boot. The registry approach in windows is just run once. Deleting the entry from the registry is automatic.

There is also the startup folder. What are you really trying to do?thanks for replying SIDEWINDER. what i really want to do is to create a bat file which restarts the computer then run a memory TEST then print the result to a text file. thanks...You really can't expect to run a batch file that reboots the system have that same batch file pickup from where it left off after the boot

Either of the two methods posted above will work. Just require a little planning.

Using the startup folder, you could start a batch file to do your memory test. You could reboot the system manually and be sure to remove the batch file from the startup folder before the next boot.

Not for nothing but what OS are you using?

8-)I am using XP. Ok thanks sidewinder for letting me know that it can't be done easily. I dont have to waste ANYMORE time searching for it. I will try your METHOD above. Thanks again sidewinder

5326.

Solve : Compare Directory listing (file names and size)?

Answer»

Hello ,

I am mainly a Unix person , but now I have to write a DOS program to compare filename and sizes after I download files from FTP server to check if no of bytes match and then create a FTP script on the fly to delete only the files I downloaded. This is required as new files are added every minute on to the FTP server.

Here's how far I have come

I get the LIST of files from UNIX server into a FILE say list.txt
here's the contents of the file

-rwxrwxrwx 1 ksura oradev 199 Dec 19 2005 9852_pgu.ctl
-rwxrwxrwx 1 ksura oradev 1773 Dec 19 2005 9852_pgu.log
-rwxrwxrwx 1 ksura oradev 285 Dec 19 2005 9852_temp.ctl
-rwxrwxrwx 1 ksura oradev 2124 Dec 19 2005 9852_temp.log

now I downloaded all these 4 files by creating a temporary bat file using find echo command

FOR /F "eol=; tokens=5,9 delims=, " %%a in (list.txt) do @echo get %%b >> download.ftp

now after I login and execute download.ftp , my next task is to compare the bytes of the files I downloaded with that of list.txt
and if they match then I have to reconnect and delete the files from FTP server.

Please help me with the script for reading each line from list.txt and for each file name, find that file in current directory and comapre the size with that of list.txt

any help will be greatly APPRECIATED.

5327.

Solve : registry remote and errorlevel??

Answer» HELLO,

I am changing 2 REGISTRY KEYS on remote COMPUTERS which works fine.
Little PROBLEM is the errorlevel.
How can I intercept failures?
Seeking and solve would be very timeconsuming.

(OS is NT4)

I am a bit pressed for time at the moment, sorry...

Uli
5328.

Solve : getting one folder down, take it in a var, g?

Answer»

Hello...

I want to get the full path name of a one folder down the BATCHSCRIPT in a variable and have to be in the folder where the SCRIPT is back.
It is on a network share.
Is there a more elegant way like this: (it looks a bit unaesthetic.)

cd..
for /f %%a in ('pwd') do set installiert=%%a\installiert.txt
cd %~dp0

(OS is NT4)

thanks in advance
uli

5329.

Solve : %systemdrive% question?

Answer»

Is there a COMMAND LIKE %systemdrive% wich is MOSTLY c:\, for a dvd DRIVE?
I WANT to install a program from my dvd to the harddrive.
I dont want to copy the program first to the hard drive and then install it with the %systemdrive% command.

My ex.

start /wait %systemdrive%\Programmas\ts2_client_rc2_2032.exe

With what can I replace %systemdrive% so if I mount the dvd in d:\ or e:\ so the pc knows were to find it?

Edit: never mind I found it in one of the article on the forum %CD%

close topic thx

5330.

Solve : For Loop Problems?

Answer»

Ok, I am trying to write a batch file that will make a MS Word document, and I have 99% completed, the document is a list of tracks in a directory, and serves as a label for a CD, my only problem, is that I have a FOR IN DO loop, in which the file name of each track, minus the extension is written to the file, works perfectly, however, I also have an ITERATOR variable in the loop that I += each time to INCREMENT, this allows the track number to be written to the file, here is an example of the code I am trying to write, and the problem with it is that when I access the index variable, it writes the pre FOR loop value, not the new += value that is assigned in the FOR loop, any suggestion?!?

::SAMPLE code
SET index=0
FOR %%i IN ("C:\\*.mp3) DO (
SET /A index += 1
ECHO %index%. %%~NI >> .doc
)
ECHO %index%
EXIT

This code works fine it outputs each new %%~ni with no problems, however, when %index% is accessed each time, the value 0 is always written
When the %index% is accessed the last time by the ECHO line, outside the FOR loop, the proper value is outputed, is there anything I need to do to "update" let SAY, the index variable value within the for loop so that the proper new value will be outputed?Using a subvariable fixes the set problem:

SET index=0
FOR %%i IN ("C:\\*.mp3) DO call :sub %%i


:goto :EOF
:sub %%i
REM %%i is now %1
REM I never tried the qualifiers in a sub
REM %%~ni should be something like %%~n1; no guarantee...
SET /A index += 1
ECHO %index%. %%~ni >> .doc
ECHO %index%

:EOF

hope it helps
uli

5331.

Solve : echoing the?

Answer»

I'm automating a batch file that will CREATE another batch file and put the & character in it. When I TRY to:
echo this&test
I receive an error (you can try this in a dos BOX). If I put quotes around it, I GET the & plus the quotes. I only want it to echo exactly: this&test Suggestions?

Thanks!echo this^&test

5332.

Solve : XCOPY: Asking for the destination folder?

Answer»

How could I have the .bat file ask for the destination folder.

In this case I want the batch to copy a folder from my C:\ to my flash drive, but I will be using this batch on multiple computers, and the flash drive may be K:\ on one computer, but can easily CHANGE to I:\ on another. So how would I do that?

All computers Windows XPWith XP you're in luck. Use the set command to get input from the user.

Code: [Select]@echo off
set /p var=Enter destination folder:
xcopy sourcefolder %var%

HOPE this helps. 8-)

Of course you could be really clever, write a Windows script and have the script determine the drive letter of the flash drive. But we'll leave that for another day.Hey, thanks! Worked fantastic! But I just have a quick question... Why do you need the @ SYMBOL before the echo off? I did a search of the home page, and the syntax for the command, it said, was just ECHO [ON|OFF], and didn't talk about the @. Could you explain it to me?The @ prevents the command from being echoed to the console. You can prefix any command with @, but @echo off is a catchall for every command following the echo statement or until echo is turned back on.

8-)Oh neat! Thanks for the explaination . But now I have another question. Would that mean to turn the echo back on, I would need to do @echo on ?

I'm sorry that I have to ask, but currently my computer's in BEST Buy, and now I have to use linux. Ugh. Though it Does present an oppurtunity to learn some python! No. ECHO would be off, so the command "echo on" would not be shown anyway. It's only when the echo is already on that you need the @.

Best advice: Make a small .bat file and try it. That's how I made a good 15% of my batch discoveries.

5333.

Solve : Need Help Batch file?

Answer»

hi
i have created a near about 10 to 15 presentations in flash. and made them exe

now i have to run those each exe's for a certain period of time one after another
Can it be done with a batch file

Thanks
Any help would be appreicated
You never mentioned an OS, but one way would be to DOWNLOAD SLEEP from the Win2003 Tools and intersperse it with your exe FILES:

Example:

Code: [Select]flash1.exe
sleep 5
flash2.exe
sleep 5
.
.
.

OR

You could do this on the cheap and intersperse PING:

Code: [Select]flash1.exe
ping -n 5 127.0.0.1 > nul
flash2.exe
ping -n 5 127.0.0.1 > nul
.
.
.

If you have Win9x you can also use CHOICE but it is not recommended as it SUCKS up CPU cycles.

Note: change the number after sleep or -n for whatever time you need in seconds.

Good luck. 8-)i am using windows xpThe use either sleep or ping. KEEP in mind the Win2003 Toolkit is a large download. Ping is already installed on your machine.

Use the examples in the previous post on how to use either command.

8-)thanks will try one of this

5334.

Solve : Re: Real DOS on XP?

Answer»

Not on XP as DOS is also an operating system. You could dual BOOT a system with DOS on the first partition and XP on a second partition. There is also DosBox. Note: DosBox is an emulator not an OS.

Good luck. 8-)Win95 uses DOS technology which explains why you can go into DOS mode under Win95. WinXP uses NT technology and does not come with DOS, only an emulator (aka: command prompt). To run "real" DOS with XP you'll need to dual boot.

What DOS PROGRAMS are you referring to and what issues are you having? I have a DOS financial program that WORKS just fine in compatability mode under XP.

8-)What about a DOS boot cd? Or would that be considered an emulator and not real dos?Real DOS can only read FAT16 file systems, not FAT32 or NTFS, up to the DOS in Win95b and Win 98. What do you have?Quote

i got a legal version of[highlight] DOS 6... but MINE can simply read FAT32[/highlight], i never had any other!

I would be interested in the details of this as FAT32 wasn't even around with DOS 6. Install Virtual PC 2004 and install DOS (or Win 95) in that

I have done it for a client on their Win XP box, and DOS programs are running happlily (and faster) inside a virtual Win 98 environmentMS Virtual PC is listed in the software FAQ. No SEARCH necessary. See my signature.Quote
GX1_man, i got a windows 98 using FAT32... and DOS is running like it should!

You said DOS 6 running on FAT32. I want to hear the details of that. From a command prompt or DOS type in ver and press enter. What does it say?
5335.

Solve : Win2k recycled bin?

Answer»

I am using an old SAGE database program on Win2k. The data transfer is traditionally sent via floppy disk. I have since eliminated this, using networked drives with the A: or B: drive letters. I am attempting to make this operation able to work without the network present, but without floppy DISKS. I am trying to use a logical partition in place of the floppy drive. The A: or B: are not really an issue, since the program now allows any drive letter to be the destination.

The problem is, on Win2k, a recycle bin is automatically set for each partition. This can be manually be set to not set aside any space for it and delete the "recycled" file from the drive. The problem is, this change does not stay through a reboot. As soon as the computer is rebooted or shut on/off, it loses those settings and it must be done again. This cannot remain since the users of these computers are not proficient nor have security rights to do so.

Is there a way to make these changes stay? Or possibly to eliminate the recycle option ENTIRELY from a specific drive?


edit to add:

The partition is in FAT format, because the program still thinks it's writing to a floppy drive. The drive must be completely empty before it will write the data to it. That is why the recycle bin must not be present.I'd ask this question in the DOS section to see if anyone over there can do it with a batch file that RUNS on startup.
Those DOS guys are real clever but they rarely come out of their DOS cage. I was hoping there was a security setting or something I was missing that would allow that setting to stay. If you go to the recycle bin properties and configure drives seperately, then move the slider bar for maximum drive for recycle bin to 0%, and check the "do not move files to recycle bin" box, then delete the recycle bin its self from the drive everything works fine. For some reason, when you check the box first and it grays out the slider bar, and it still sends stuff to the recycle bin. Gotta move that slider bar first. I just THOUGHT it odd that you can set it up to work like that, but as soon as you log off or reboot it goes back the way it was. Why would it not save this setting?

5336.

Solve : small problem?

Answer»

HI All,

I have got one problem in my system.when i enter commands like NOTEPAD,net etc., they were not executing in command PROMPT but they are executing in RUN.what i want to do to run in command prompt.I will be waiting for ur reply.
With REGARDS,
RamaFrom the command prompt, you need to use Start notepad.exe to EXECUTE a gui program
GrahamDo you receive any error message, what happens when you enter Notepad at the command prompt :-?

5337.

Solve : batch to open and close mapped drive?

Answer»

Hi

I was wondering if I could get some help in creating a bat or cmd to perform a particualr function in Windows XP.
In a PARTICULAR scenario I am working on, a server will backup files from network computers. But before that, I need a batch file to execute and check that the mapped drives on the server to client computers are active and available (as the backup will not WORK if the mapped drives auto disconnect)

So far I have worked out:
start L:\
will open the mapped drive L and show its folder contents (therefore verifying mapped drive has not disconnected and is ready) , but now how do I close the drive window?

In other words, what command would I use to now close the L drive window I opened with command 'start'?To check if a drive is mapped (active) you can analyze the output of the "net use" command.
Parse it with a for loop.

uliQuote

In other words, what command would I use to now close the L drive window I opened with command 'start'?


"exit" closes the window

uli

uli

both solutions sound interesting, my only PROBLEM is how to syntax your results
would you be able to help me CONSTRUCT the batch file CODE? I have really no idea how to do it
5338.

Solve : Batch file to convert a file?

Answer»

Hello,

I have a FILE and would like to count in this file the COMMAS in each line.
If there is less than 20 commas, I would like to insert the difference at the end of each line.

Thanx in advance.i am no GOOD at batch for such tasks. So here's one done in Python (similarly can be done in other scripting languages)

Code: [Select]for lines in open("thefile.txt"):
lines = lines.strip() #GET rid of NEWLINES.
commacount = lines.count(',') # count how many commas
if commacount < 20:
print lines + "," * (20-commacount) # print the remaining commas
just a few lines of code and im done.

5339.

Solve : Copying a folder?

Answer» HELLO again,

I'm making myself an AUTO installer wich also copies folders into another folder. But the problem is that i don't have the code to COPY the whole folder to somewhere else.
I hope you guys (and girls) can help me!

Greetz RubenXCOPY?Hmm doesn't seem to work, I've got this so far:
Code: [Select]XCOPY "C:\ZStuffZ\CounterStrike Source\Data\CounterStrike Source\Level Parts\materials" "C:\ZStuffZ\CounterStrike Source\Data\CounterStrike Source\Level Parts\test"
The names of the root map is *materials* , in this map there 3 other maps, I want that the batch file copies them all with content to the map NAMED *test*

Thanks in advanceXCOPY /s "C:\ZStuffZ\CounterStrike Source\Data\CounterStrike Source\Level Parts\materials" "C:\ZStuffZ\CounterStrike Source\Data\CounterStrike Source\Level Parts\test"

The /s SWITCH copies all subfolders with contents.

try xcopy /? for more info.

uliThanks guys! I got it fully working now!
5340.

Solve : delete line from the file?

Answer»

How do i delete the line from the file ?

For example i have file .If i run the for loop first time the first line of the file should be deleted.If run second time it has to delete the second line ETC .could you please help me to do it?
You never mentioned your OS this but may work:

Code: [Select]@echo off
setlocal enabledelayedexpansion
SET count=0
for /f "tokens=* delims=" %%i in (data.txt) do (
set /a count=%count%+1
if not !count!==1 echo %%i >> data1.txt
)

Text files do not allow in-place deletes; you MUST create a SEPARATE output file.

8-)

Quatroking has a point. Run this enough times and you'll run out of lines to delete. Quote

How do i delete the line from the file ?

For example i have file .If i run the for loop first time the first line of the file should be deleted.If run second time it has to delete the second line etc .could you please help me to do it?


can you provide a use case for this? from what i see, it SEEMS your intention is to delete all the lines of the file? if it is, just
Code: [Select]
type nul > yourfile.txt
will do. This will blank out your file. I may be wrong though

5341.

Solve : Who has real dos??

Answer»

Because I don't have real dos, just command prompt, and I was wondering if theres even people that use dos anymore??!!!I have it on one old machine (v 6.22), and up to Win98 can be considered "kind of" a real DOS as well, even though it has a command prompt as you can reboot in DOS mode.

I have it ... just in case I need it. I only have 1 computer that runs DOS as the only operating system ... and that is a very old comptuer that has a bunch of DOS games on it used for entertainment. I have some DOS boot disks and CDs that I use for troubleshooting computer problems. I still have LEGAL copies of DOS 3.31, 4.01, 5.00, 6.00, 6.20, 6.22, but the DOS I use for my boot CDs are DOS 7.10 from Windows 98.I use MS-Dos 7.10 regularly, also have 6.00, 6,20, 6.22 and know where to download 5.00, 4.01, 3.30r, 3.30a, 3.30 and 3.2 (but I'm not telling)

I have an old IBM-AT 286 that runs PC-DOS 7 and Windows 3.1. It has a 20MB harddisk and 512KB RAM. Two floppies and an external Hayes modem. Runs at the blazing speed of 8MHz.

This was back in the days when PC's came with manuals that explained the DOS commands, the BASIC language, and even wiring diagrams of the BOX! IBM even THREW in REXX with that release of DOS!

Nowadays you buy your PC and you might get a foldup wall poster on how to setup your machine, a kick in the *censored* and a good luck. You might even get a tech support number (good luck with THAT).

I crank it up once in a while to KEEP me humble. 8-)I run dos 4.01 on my Sharp 7200 portable, with an amazing 700kb ram and no extended memory...mmm...5 1/4" boot disks! My friend's dad still uses an Atari for his business. Well, if it works, it works.I use regularly M$-Dos 6.22, 7.10 and Caldera DrDos Bootdisks for Diskimaging and stuff.
(And I am happy with it; a nice contrast to the daily Windows work and more control.) :-)

uli

5342.

Solve : Any help maybe??

Answer»

Basically, Ive been writing a batch file which activates all firewalls/proxies/anti-virus etc. programs at once. I was wondering if there is a way to properly deactivate my networkcard from DOS.
The only way I know is ipconfig /release or netsh mode mode=offline but that dosnreally deactivate the card does it!?
Id be very thankful for support in terms of changing states of hardware in DOS.

thx 4 the PATIENCE, JADM 8-)assuming you have XP, you can try devcon at http://support.microsoft.com/?kbid=311272. there's an OPTION called "disable" you could USE.

5343.

Solve : Recovering files in DOS??

Answer»

How can I recover a deleted file in DOS?
As in:
I deleted a file from the recycle bin.
Now how do I get it BACK?
(Also as in I don't have System Restore, or drive TEMPORARY archive)
I'm presuming you mean the Command PROMPT in XP.

Why do you need to use the Command Prompt, why not use one of the many free recovery progs around - such as Restoration :-?

But first you have to know how deleted files are treated - as in renamed - please read this and this

Meantime do as little as possible with the hdd as the deleted file(s) may be overwritten.

Good luckOk, I downloaded "Undelete" DOS and Windows version.
(I have Windows 98)
Did someone REPLY to this thread? I just got an email saying someone did...If you delete it from the Recycle Bin it is gone without DATA recovery software.

5344.

Solve : Assigned for Awk in another Section?

Answer»

Quote from: ghostdog74 on December 27, 2009, 07:13:53 PM

I see your code, but wonder where are awkbat6.bat and awkbat8.bat ? I have also run your code, but I have another question, if I have more data, like 309, 310, 311 etc...do i have to create awkbat09.bat , awkbat10.bat, awkbat11.bat etc as well?


I posted awkbat8.bat but you said you were not interested.

Awkbat6.bat and awkbat8.bat is generic code that will work for any line as it did for line 301.

I saw no other input files from Eldorado,Topic Starter, other than what was used.

If Ghostdog 74 is really interested in a batch solution, please post the code you have written and we will work together. I see no need to continue if you don't offer to help.

Quote
Only one person in 1000 have access to Awk (gawk ) files

HuH?

gawk for windows is available to everybody with internet.

http://gnuwin32.sourceforge.net/packages/gawk.htmQuote from: Geek-9pm on December 27, 2009, 07:33:17 PM
HuH?

"gawk for windows is available to everybody with internet."

http://gnuwin32.sourceforge.net/packages/gawk.htm

My mistake. I should have written that only one in 1000 ever download or use awk (gawk).

Thanks for the download site.

http://gnuwin32.sourceforge.net/packages/gawk.htm

I will try again.Quote from: BillRichardson on December 27, 2009, 07:46:06 PM
My mistake. I should have written that only one in 1000 ever download or use awk (gawk).
this is baseless and is fit for the rubbish bin.Quote from: BillRichardson on December 27, 2009, 07:29:28 PM
I posted awkbat8.bat but you said you were not interested.
Awkbat6.bat and awkbat8.bat is generic code that will work for any line as it did for line 301.
you keep saying there is awkbat8.bat, but where is it ??
and if they are generic, then why are there 2 versions of it awk6 and awk8?? if its generic, you should make it such that it works for all scenarios, no matter whether there are 309, 310 or 411 etc... why is there a need to call that many .bat files??

I am really a beginner in batch, and my gawk solution solves the problem for data like this
Code: [Select]C:\test>more file
301|AF_ACC_BDL|774;
301|AF_WMG_BDL|6660;
301|AF_REP_BDL|4735;
303|AF_ACC_BDL|1360;
304|AF_ACC_BDL|5092;
305|AF_ACC_BDL|32384;
306|AF_ACC_BDL|80859;
306|AF_REP_BDL|80875;
308|AF_ACC_BDL|1418;
308|AF_WLH_BDL|78273;
308|AF_WSL_BDL|9990;
308|AF_WFL_BDL|9998;
309|AF_BLA_DDD|9999;
309|AF_BAL_DDE|99999;
309|AF_AAA_DDW|99959;
310|AF_XXX_AAA|1345;
310|AF_YYY_AAA|1235;
310|AF_ZZZ_BBB|1245;

C:\test>gawk -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a[i] } }" file
310 |AF_XXX_AAA|1345;|AF_YYY_AAA|1235;|AF_ZZZ_BBB|1245;
301 |AF_ACC_BDL|774;|AF_WMG_BDL|6660;|AF_REP_BDL|4735;
303 |AF_ACC_BDL|1360;
304 |AF_ACC_BDL|5092;
305 |AF_ACC_BDL|32384;
306 |AF_ACC_BDL|80859;|AF_REP_BDL|80875;
308 |AF_ACC_BDL|1418;|AF_WLH_BDL|78273;|AF_WSL_BDL|9990;|AF_WFL_BDL|9998;
309 |AF_BLA_DDD|9999;|AF_BAL_DDE|99999;|AF_AAA_DDW|99959;

notice the data now has 309, 310?? (and you can add more), but it will still solve it, without adding extra code. Now all i am asking you , since you started to do this in batch, is to do the same. I do not want to create extra batch files. I just want to do it in one batch file...is that ok ?? can you show me how please, in batch ?



GH,

I'm not an expert with batch. I suspect someone by email has given you a better batch solution. My solution works. It is not a good design nor good code. You need someone with more skill than I can offer. Good Luck. We are getting nowhere. You need a new start. Send me your new batch program.

p.s. I got the gawk to work but not with the "all one line" problem.
As good as you are: start from scratch and write a new batch for this problemI nominate this thread for *censored* of the year award.

In fact, I find it so *censored*-ey that I might even require it's URL as part of a shebang line for BCScript files, heh.

Quote from: BillRichardson on December 27, 2009, 10:10:34 PM
As good as you are: start from scratch and write a new batch for this problem

Why? he has a working AWK solution.

Additionally I might wonder aloud why it is that you prefer batch over VBScript and JScript? your reasoning for awk is that it needs t be downloaded; but VBScript and JScript COME with ALL installations of windows since windows 98SE; any windows install past windows 95 (in fact, windows 95 has an OS update that I believe installs ActiveX Scripting engines such as VBS and JS) can use VBScript files. There is no reason to write a batch file if a working VBS or JS solution is provided, and works better. your statements that they are "easier to understand" are merely expressions of your own opinion and not actually decided through any real experience with people using VBS and batch files. batch files ALWAYS open a command prompt window; this, in and of itself, is enough to scare new users sometimes. VBScript, on the other hand, can be written to use WScript.exe and therefore use dialogs and Inputboxes rather then scary text mode Command prompt UI, so anybody who wouldn't understand VBScript would likely prefer the VBScript solution anyway, which brings up the point that the idea isn't always to educate the person seeking help as to the intricacies if the language, but rather to simply provide a solution; sometimes a batch solution, sometimes VBScript, but there is absolutely, positively, no reason to lean towards batch unless the OP has expressed a EXPLICIT interest in only batch-based solutions, and even in those cases a VBScript can be adapted to run from within a batch script anyway so the point is moot. If the OP then becomes interested in learning VBScript, they can be referred to a number of fine resources. I might even conclude that VBScript is EASIER for a new user to understand; BASIC statements roughly translate into plain english:

Code: [Select]For Each Value In Collection
Print Value
Next Value

Is a *censored* of a lot easier to read then:

Code: [Select]For /f %%P in (`type collection`) do echo %%P

Sure, they both have similarities, but the batch version is not exactly plain english, there are far too many semantics that would need to be explained, such as why there are percent signs, and of course why it is that when the OP uses the command at the command prompt you need only a single % sign. Batch being "simple" is a huge misperception by a large number of users, even the base language as used in Pure DOS is relatively confusing.

Only language I can think of being more "english-like" then BASIC might be python; I don't have extensive experience but I will not argue the repeated point Ghostdog makes that it is easy t olearn for a beginner. It may not ALWAYS be the best choice (which I believe is where I and ghostdog disagree) but it certainly isn't a bad starting point for anybody.

Batch Is. Trust me, I know from experience that learning batch programming first can become a hurdle later on when learning a less domain-restricted programming language. When I first started with QBASIC after using batch, it took some time to realize that I wasn't writing commands, I was writing statements; my previous experience with batch was certainly only a minor hurdle, but a hurdle nonetheless. It's not necessarily a bad thing to learn batch; it's a bad thing to try to learn another language from the PERSPECTIVE of batch semantics, which I believe would hold true for nearly any programming language; they have different "spirits" to steal the term from Bruce McKinney, Author of "HardCore Visual Basic"; for example, the C "spirit" pretty much says the programmer is in control of everything; memory allocations, deallocations, everything must be done by them, and it is this "total control" concept that lends itself to streamlined, low-level C code. Visual Basic tries to hide a good number of things about windows programming from the programmer, sparing them the troubles of creating and maintaining window handles, sending and recieving window messages, etc. There is of course some allocation to be done, such as dimensioning variables (optional, actually, defaulting to the Single data type in Version 1 and to Variant In versions after, unless a Deftype statement is found in the declarations section of a module, in which case the default type for that module is the specified type), but once a variable goes out of scope, it is automatically destroyed. To some extend, C will do this; for static variables declared within procedures. However, pointers will NOT be automatically deallocated in C and this must be dealt with properly. The "spirit" if batch is the very essence of a "glue" language, that is, calling of a number of programs that were compiled in other LANGUAGES (things like format, find, etc) in predefined orders, and with very specific and basic Control flow that was pretty much a spaghetti of gotos. It has evolved past this stage but it is still a glue language at it's core, and a glue language is limited in far too many ways to count and at the same time its powerful by the sum of the parts that is happens to glue together.

One of the things that batch can use as a glued piece is AWK, just as VBS code can be written to a file and executed from a batch, so to can AWK be executed from the command line, as an extension of batch.

Consider for a moment that almost every batch program calls into another program to do it's work, and all batch programs rely on cmd.exe to perform at the very least basic interpretation of the file; ther eis no denying that it has limitations, and one of these limitations can be found in text processing. warranted, it CAN do text processing, but it takes experience and patience to get it working; on the other hand, scripting languages like VBS have a number of string functions at their disposal, and their Date/time manipulation is simply not matched by any feasible batch solution.

Quote from: BC_Programmer on December 28, 2009, 07:47:04 AM
I nominate this thread for *censored* of the year award.

BC writes many lines of nonsense and says nothing and offers no code of any kind as a solution. What happened to the Perl Solution from BC? Where is there a solution of any kind offered by BC?

Is Bc the DILETTANTE of the Hope Board?

dil·et·tante (dl-tänt, dl-tänt, -tänt, -TNT, -tnt)
n. pl. dil·et·tantes also dil·et·tan·ti (-tänt, -tn-)
1. A dabbler in a field of knowledge. See Synonyms at amateur.

Superficial; amateurish.Learn to read, troll.Quote from: BC_Programmer on December 28, 2009, 04:19:12 PM
Learn to read.

Where is BC's code?Quote from: BillRichardson on December 28, 2009, 05:17:53 PM
Where is BC's code?

What code? I never promised any code.Let's boycott him.

5345.

Solve : How do we use gawk.exe??

Answer»
I got the following errors using gawk.exe. MAY we run gawk.exe from the command line?

C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" '{a[$1]=a[$1] FS $2 FS $3 } END {for(i in a){print i,a} }' awkinfile.txt
gawk: '{a[$1]=a[$1]
gawk: ^ INVALID char ''' in expression

C:\batch>type awkinfile.txt
301|AF_ACC_BDL|774;
301|AF_WMG_BDL|6660;
301|AF_REP_BDL|4735;
303|AF_ACC_BDL|1360;
304|AF_ACC_BDL|5092;
305|AF_ACC_BDL|32384;
306|AF_ACC_BDL|80859;
306|AF_REP_BDL|80875;
308|AF_ACC_BDL|1418;
308|AF_WLH_BDL|78273;
308|AF_WSL_BDL|9990;
308|AF_WFL_BDL|9998;


C:\batch>

use double quotes instead of single quotes on win32. Read the gawk manual under Getting Started section 1.1.6.1 Quoting in MS-DOS Batch Files.

CODE: [Select]gawk.exe -F"|" "{a[$1]=a[$1] FS $2 FS $3 } END {for(i in a){print i,a[i]} }" awkinfile.txt
Quote from: ghostdog74 on December 27, 2009, 08:18:09 PM
use double quotes instead of single quotes on win32. Read the gawk manual under Getting Started section 1.1.6.1 Quoting in MS-DOS Batch Files.

Code: [Select]gawk.exe -F"|" "{a[$1]=a[$1] FS $2 FS $3 } END {for(i in a){print i,a} }" awkinfile.txt



C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3 } END {for(i in a){print i,a} }" awkinfile.txt

gawk: (FILENAME=awkinfile.txt FNR=13) fatal: ATTEMPT to use array `a' in a scalar context

C:\batch>type awkinfile.txt
301|AF_ACC_BDL|774;
301|AF_WMG_BDL|6660;
301|AF_REP_BDL|4735;
303|AF_ACC_BDL|1360;
304|AF_ACC_BDL|5092;
305|AF_ACC_BDL|32384;
306|AF_ACC_BDL|80859;
306|AF_REP_BDL|80875;
308|AF_ACC_BDL|1418;
308|AF_WLH_BDL|78273;
308|AF_WSL_BDL|9990;
308|AF_WFL_BDL|9998;


C:\batch>I really can't stand you. Did you copy and paste my code properly? if not, type it in correctly on your terminal.!!! Quote from: ghostdog74 on December 27, 2009, 08:46:24 PM
Did you copy and paste my code properly? if not, type it in correctly on your terminal.!

The code does not work and you blame me? We can see the code is the same as was given. I USED copy and paste.

How could we not copy and paste correctly?

Here it is again:


C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $
3 } END {for(i in a){print i,a} }" awkinfile.txt
gawk: (FILENAME=awkinfile.txt FNR=13) fatal: attempt to use array `a' in a scalar context

What is typed incorrectly?

C:\batch>Quote from: ghostdog74 on December 27, 2009, 08:46:24 PM
Did you copy and paste my code properly? if not, type it in correctly on your terminal.!

I used another awk program* and it worked:
http://www.pement.org/awk/awk1line.txt

C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" "{ total = total + NF }; END {
print total}" awkinfile.txt
12

Quote from: ghostdog74 on December 27, 2009, 08:46:24 PM
Did you copy and paste my code properly? If not, type it in correctly on your terminal.

I finally got your "all in one line" gawk to run. Thanks for your help.
Here it is from my machine:

C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a } }" file
||
301 |AF_ACC_BDL|774;|AF_WMG_BDL|6660;|AF_REP_BDL|4735;
303 |AF_ACC_BDL|1360;
304 |AF_ACC_BDL|5092;
305 |AF_ACC_BDL|32384;
306 |AF_ACC_BDL|80859;|AF_REP_BDL|80875;
308 |AF_ACC_BDL|1418;|AF_WLH_BDL|78273;|AF_WSL_BDL|9990;|AF_WFL_BDL|9998;

C:\batch>

p.s. I used copy and paste
Code: [Select]gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a } }" file
the above will give you error at this part here ---------------------^. it should be
Code: [Select]gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a[i] } }" file

so i really doubt you are doing the right thing.gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a } }" file
[/quote]
So I really doubt you are doing the right thing.
[/quote]

I got the right answer and posted the output. Thanks for your help.

I finally got your "all in one line" gawk to run. Thanks for your help.
Here it is from my machine:

C:\batch>"C:\Program Files\GnuWin32\bin\gawk.exe" -F"|" "{a[$1]=a[$1] FS $2 FS $3}END{for(i in a){ print i,a } }" file
||
301 |AF_ACC_BDL|774;|AF_WMG_BDL|6660;|AF_REP_BDL|4735;
303 |AF_ACC_BDL|1360;
304 |AF_ACC_BDL|5092;
305 |AF_ACC_BDL|32384;
306 |AF_ACC_BDL|80859;|AF_REP_BDL|80875;
308 |AF_ACC_BDL|1418;|AF_WLH_BDL|78273;|AF_WSL_BDL|9990;|AF_WFL_BDL|9998;

I had a long rant here but realized it was just a waste of time.

Quote from: ghostdog74 on December 27, 2009, 08:46:24 PM
I really can't stand you.

We'd be hard pressed to fine somebody who does!Quote from: BC_Programmer on December 29, 2009, 10:26:18 AM
I had a long rant here but realized it was just a waste of time.

We'd be hard pressed to fine somebody who does!

Thanks for the kind words. I'm doing something right.

Sincerely,

Bill Richardson
5346.

Solve : Delete??

Answer» HI I own a Game Server and I need a Batch that will DELETE any file inside the folder the batch is in that has a name longer than 12 chars..

Example

It will be in the "characters" folder and it needs to delete any .txt file that is named ANYTHING longer than 12 chars.

C:\batch>type great12.bat
Code: [Select]@echo off
dir /b *.txt > 12long.txt
awk.exe "length > 12" 12long.txt > great12.txt

for /f "delims=" %%i in (great12.txt) do echo %%i

rem for /f "delims=" %%i in (great12.txt) do del %%i
Output:

C:\batch> great12.bat
2awkinfile.txt
awkinfile.txt
awlinfile.txt
caavsetupLog.txt
christmas.txt
endresult.txt
finalziplist.txt
Instruct_for.txt
list_of_program_files.txt
outinfile.txt
testfilnam.txt
xsplfiles.txt
C:\batch>@OP:

you might want to put rem before this line:
Code: [Select]for /f "delims=" %%i in (great12.txt) do echo %%i

and remove the rem from this line:
Code: [Select]rem for /f "delims=" %%i in (great12.txt) do del %%i
Quote from: BillRichardson on December 29, 2009, 12:19:26 PM
C:\batch>type great12.bat
Code: [Select]@echo off
dir /b *.txt > 12long.txt
awk.exe "length > 12" 12long.txt > great12.txt

for /f "delims=" %%i in (great12.txt) do echo %%i

rem for /f "delims=" %%i in (great12.txt) do del %%i

you can use gawk's FILENAME variable, IF you have gawk.
Code: [Select]C:\test>gawk "length(FILENAME) > 4 {print FILENAME;nextfile}" *.txt
5347.

Solve : Check the free disk space?

Answer» ENOUGH...once again.
Topic Closed.

patio.
5348.

Solve : Copying backup files in DOS?

Answer»

What I want to do is to boot up in DOS and copy every file on my hard drive to another partition or burn it to a DVD, so that later I can format the system partition and copy all those files back. Can this be done from the command prompt?Welcome to the CH forums.

Yes, what you want to do is possible but please tell us what you are TRYING to achieve. When you copy the files back to the system partition a bootable disk will not be created, if you want to create a bootable disk you should look at cloning.

But first tell us why you want to format your system partition.

I like to format the hard drive and do a fresh install of Windows every so often, to get rid of the junk. What I would like to do is to do a fresh install, activate Windows, and then immediately make a backup so in the future I won't have to do the ACTIVATION THING again. I don't always have ACCESS to the internet for doing the activation.THis is just the JOB for Norton Ghost (pre version 10) or else a free alternative such as dd (for Windows).

OK, I'll try that, thanks.

5349.

Solve : How to search a certain file and repeat until found?

Answer»

Hello, I am new to the forums and thanks everyone for your help.

I am having trouble creating a SIMPLE batch file that has to look over the root directory for a file that is located into the removable media, and if found, rename that file.

To be more PRECISE, I have a freeware Antivirus for removable drives named Mx One. The trouble right here, is that I was creating an Auto-Update option with Autorun, that executes the program, and then having the choice for the user to update it for himself whenever he inserts his USB. But my trouble right ahead, is that when the Update function of Mx One Antivirus launches, it deletes the previous sequential file, and continues the sequence and creating a new file.

For example I open: Mx one 0001.exe I update, so Mx one 0001.exe no longer exists, and Mx one 0002.exe is created instead ONLY if update is selected.


I want to execute a batch file that looks for the next sequential file, (something repeated in a FOR loop) ending at a MAXIMUM integer or until found, having something like this:

for index=1 index<99(or until found)
IF EXIST filename+index

rename filename > newfilename

EXIT


Thanks for your help.

From my limited knowledge of batching there is no incremental function. So USING an index is tricky. However you can run the for loop to loop for all of a certain file type in a folder. For example:

Code: [Select]for %%I in (*.sql) do {} (
will search through the directory for all .sql files and do whatever is encapsulated in the do { }

A work around I found for INCREMENTING if you need a numeric value is putting this at the end of the loop:

Code: [Select]echo 1 >> i.txt
This will make a i.txt file with a series of 1's for each time the loop reaches the end. Use this in tandum with:

Code: [Select]find /c "1" i.txt > i2.txt
This will result in the number of 1's in i.txt and print it to i2.txt (I haven't attempted to put the value in a variable but I don't see why it wouldn't work) but there is your number that has been incremented.

Hope this is somewhat helpful.
Here is how to increment in batch:

for /l %%a in ('1,1,100') do echo %%a

I think...LolQuote from: Helpmeh on December 30, 2009, 01:27:17 PM

Here is how to increment in batch:

for /l %%a in ('1,1,100') do echo %%a

I think...Lol

Something along those lines.

I was exploring a solution for this thread with that particular construct but realized that it would be more difficult than that: the numbers would need to have an appropriate number of zero's prepended. the bleeding obvious VB equivalent,
Code: [Select]strnewname= "mx one " & String(4 - Len(Trim(Str(Number))), "0") + Trim(Number) & ".exe" doesn't work in batch.

Oh... heh, I could always write a little script, I suppose; I'm not certain what the desired result is; that is, what "newfilename" is to be (?)
Making a good batch file can be a lot of fun. But a person is better motivated to do a good job if they have a good reason.

Looking over your original post, I don't see a very good reason for doing this. Pardon me, but that freeware program you're REFERRING to works very well just the way it is. So I don't get the point. You already know that it's going to give itself another name and delete the prior version. So what's wrong with that?
But, if you insist, it's quite easy to find a file that has a certain name or has some ambiguity in the name. Now the question would be; Suppose to found 100 files that have ambiguous names. Do you want to delete them all? You want to rename the mall? Or just rename the last one and delete all the others?
You objective is either not clear or in unreasonable. Remember, Reason must precede logic.Quote from: Geek-9pm on December 30, 2009, 02:18:47 PM
Making a good batch file can be a lot of fun. But a person is better motivated to do a good job if they have a good reason.

Looking over your original post, I don't see a very good reason for doing this. Pardon me, but that freeware program you're referring to works very well just the way it is. So I don't get the point. You already know that it's going to give itself another name and delete the prior version. So what's wrong with that?
But, if you insist, it's quite easy to find a file that has a certain name or has some ambiguity in the name. Now the question would be; Suppose to found 100 files that have ambiguous names. Do you want to delete them all? You want to rename the mall? Or just rename the last one and delete all the others?
You objective is either not clear or in unreasonable. Remember, Reason must precede logic.

Thanks for the help. The purpose of this batch file, is that when the common box dialog that Autorun launches, it calls this batch file. I was creating the ability for the user to open the program every time it clicks on the desired option of the Autorun Select Option Dialog. As I said, I can do this everytime I want if the file I'm looking for is named Mx One 0001, for example, as I said.

But when I do want to execute it, via the command line, in order for it to be called, executable files cannot have spaces in their names, so that's why I have to rename Mx?One?0001.exe to MxOne_Antivirus.exe, that is a valid executable file name at Command prompt.

The reason I'm doing, is for a school project, hehe sorry to not mention that.

My logic behind this, is to look the file name with an Index, as BC_Programmer stated with a VB Script instead of a Batch file; first I rename it (obviously a command prompt shows up as usual) and then, it renames Mx One 0001.exe IF Found

IF NOT EXIST, then I have to look over the removable drive (only at its root) for the *.exe name containg at Least Mx One+an Index over it, then again, IF FOUND, rename that file to MxOne_Antivirus.exe that is a valid executable filename and last, launch it via command prompt (batch file), repeating this operation several times with a limit. (similar to search until found, obviously this limit has to be a little bigger).

If this is more complex, and there's another portable, or practical solution like C, C++ or Java, or another programming language, please suggest

Thanks


PD With an Index I mean that the file has an ambiguity in its name, following your advice. This ambiguity is that the file deletes itself when you update, and changes its version that follows a sequence. So I do want to look up for the filename with an Index over its String name, and if found rename... bla..

Quote from: BC_Programmer on December 30, 2009, 01:47:51 PM
Something along those lines.

I was exploring a solution for this thread with that particular construct but realized that it would be more difficult than that: the numbers would need to have an appropriate number of zero's prepended. the bleeding obvious VB equivalent,
Code: [Select]strnewname= "mx one " & String(4 - Len(Trim(Str(Number))), "0") + Trim(Number) & ".exe" doesn't work in batch.

Oh... heh, I could always write a little script, I suppose; I'm not certain what the desired result is; that is, what "newfilename" is to be (?)



The new filename to be is, as my previous reply with a valid name, in order to be executed.

It searches for Mx One 0001.exe, IF Found it renames this *.exe file for MxOne_Antivirus.exe, then it launches MxOne_Antivirus.exe that is the new Filename prior to the last one that was Mx One 0001.exe. This obviously, always works due that it only has to look for Mx One 0001.exe, but when you update it, a new filename with the next sequential version creates, deleting the previous one and leaving only the new one. So as I firstly explained: Mx One 0001.exe no longer exists, and Mx One 0002.exe is created instead. This is the UPDATED filename, with the newest deffinitions.

I want to look over this ambiguity, leaving the ability for it to be an Auto-Execute option, that is called from my Modified Autorun.inf file, that calls this particular batch file.


Thanks for any further help
If I understand correctly, your filenames are in the form:

"Mx One 0001.exe" with different 4 character numbers on the end or what have you.

you can rename them ALL at once! I just remembered our good friend, the ? wildcard:

Code: [Select]ren "?? ??? ????.exe" "??_???_????.exe"

of course, if for some reason you have other exe files with 2 characters, a space, three characters, a space, and four characters, it will rename these, as well. But that seems unlikely.Quote from: BC_Programmer on December 30, 2009, 05:09:51 PM
If I understand correctly, your filenames are in the form:

"Mx One 0001.exe" with different 4 character numbers on the end or what have you.

you can rename them ALL at once! I just remembered our good friend, the ? wildcard:

Code: [Select]ren "?? ??? ????.exe" "??_???_????.exe"

of course, if for some reason you have other exe files with 2 characters, a space, three characters, a space, and four characters, it will rename these, as well. But that seems unlikely.

Yes, that was exactly I was looking for, didn't know MS-DOS had that pattern . Ok, one last issue and it is minor.
Obviously anyone who gets into their USB and launches my particular option I created with Autorun it will open a Command prompt window. I want it to be hidden, or show Up, but when the Antivirus program is called, I mean when this sentence is completed succesfully, close it immediately by itself, but leaves the Antivirus program opened.

Can this be done? I've heard something about hstart execute file you have download, but it has a lot of features and more complex than I want to do.Not sure I understand, but you can use Exit in a batchfile to close it; programs it started will still execute.Quote from: Helpmeh on December 30, 2009, 01:27:17 PM
Here is how to increment in batch:

for /l %%a in ('1,1,100') do echo %%a

I think...Lol
FYI:
That way would only work if the OS he ran the batch on was NT or later.

But BC's method is more methodical(and never knew about the ? wildcard )
5350.

Solve : MS Dos and Compressed Virtual drives?

Answer»

I have a hard drive with three volumes. Two are compressed volumes and are easily viewed in the 98SE OS, but not in a dos environment. I am attempting to edit both of the compressed volumes using Nortons Diskedit, but cant get Norton to see the compressed volumes. Norton sees the volumes when I run it from the 98SE OS, but not when I run it in dos. The problem is that Norton Defaults to a Read Only status in a Windows OS. I am unable to edit the volumes that WAY. If I can get dos to see the volumes (uncompressed) then I can get Diskedit to modify the same volumes.

Any SUGGESTIONS?

Are these NTFS compressed volumes? DOS does not support NTFS.
QUOTE from: Salmon Trout on December 28, 2009, 03:42:15 PM

Are these NTFS compressed volumes? DOS does not support NTFS.


neither does win98SE.

Maybe they are Double-spaced or DriveSpaced?They are Drvspaced or perhaps Dblspace for sure. They are all FAT volumes. drvspace will decompress the volumes when I boot to a 98SE OS, so that is not an issue. The problem is when I attempt to return to a pure dos mode, the two virtual volumes are gone.

It is like this:

Windows 98SE
D:
E:
F:

DOS
D:
Quote from: hminus on December 29, 2009, 07:37:57 AM
They are Drvspaced or perhaps Dblspace for sure.

Is this when you exit Windows 98 to the command PROMPT?

To access a Drivespace compressed "volume" in MS-DOS, you need to create, and then boot from a DOS 7 boot floppy with drvspace support.




It is. Here is the breakdown.. I work the HD from a forensic boot disk , before any DCA takes place. I will look for data in the file slack and anything in the unallocated space, ect... After I am satisfied with that search, I will then shut the system down, remove the boot disk and do the following:

1. configure the HD that I wish to examine as the slave drive

2. configure my windows 98se HD as the master

3. boot to win98se and let DCA do its thing.

(it is at this point I start having problems... I have some forensic tools loaded on the 98se machine in the root directory. These tools are dos tools. I can run them in 98se in a dos box and they see the logical drives just fine, but when i exit to c:.... they are gone..)

Now one might say just use these tools in the windows dos box and be done with it... I would except programs like nortons diskedit will not allow you to get out or read only mode while operating in windows...)

======oh yea, my boot disk is version 7... I believe that is the version that comes with 98SE.

Thanks for any help.

I ask again, are you loading the drivespace compression driver when you start with the boot disk?
Yes, Drvspace, IO.SYS are there.So you are a law enforcement officer?Yes I have been for nearly 15 years now.. I am currently working on my CCE and am having a bit of trouble getting some of my DOS tools to work. When you exit to C: and they don't show up, your doing that in DosBox on the 98SE volume right?
That's the problem. The volumes show just fine in the DosBox,.. the dos tools I am using need to be in a pure dos environment to work properly. I need the volumes to show when I exit windows to DOS.

Nortons diskedit will not let you write to a disk if you are running it in a DosBox.

I think you will have to do a boot from a floppy, bypassing the hard drive W98 boot altogether. I thought you were doing this?