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.

6851.

Solve : clock speed?

Answer»

Hello All,
I am running an old DOS program in DOS on a windows 98 MACHINE, and it used to work just fine, but recently has been running way to fast (it is supposed to present images for a certain lenth of time, and they are much too fast.) If anyone has any thoughts about why this might have happened, or anything I could do to slow it back down again, I would be very happy. I have tried looking in the BIOS for a place to slow down the PROCESSOR, but that isn't an option on this machine (its an older Dell, perhaps an inspiron 4000?).
Thanks!Thsi may have OCCURED if you have added RAM to the machine recently

Try Bremze Here.No, I didn't change anything--hardware or software Click on the link i provided in Blue...

6852.

Solve : How to determine what parameter passed to a batch and do something base on it.?

Answer»

Hello All,
I have one batch script that calls several other batch scripts. This batch received a parameter and pass it on to all the other batches by replacing %1 with that parameter.

How do I determine if %1==avalue and base on that value execute a section of my batch scripts?

Your help is appreciated. Thanks in advance.
you can try to echo the %1 value out to a file before it processes the next fileerobby,
I tested that interactively VIA the command line, it didn't work.
1) set %1=parameter that will be passed
2) echo %1 or %%1 or %%1% , see the result below:
Code: [Select]C:\Documents and Settings\>set %1=parmtopass

C:\Documents and Settings\>echo %1
%1

C:\Documents and Settings\>echo %%1
%%1

C:\Documents and Settings\>echo %%1%
%%1%It needs to be in the batch file you have on no OUTPUT yet. all you did with that statement was set the first var equal to parameter.

Post a snipet from the file so that I can SHOW you what I meanQuote from: LookingForHelp on July 23, 2008, 08:22:07 PM

erobby,
I tested that interactively via the command line, it didn't work.
1) set %1=parameter that will be passed
2) echo %1 or %%1 or %%1% , see the result below:
Code: [Select]C:\Documents and Settings\>set %1=parmtopass

C:\Documents and Settings\>echo %1
%1

C:\Documents and Settings\>echo %%1
%%1

C:\Documents and Settings\>echo %%1%
%%1%

lookingforhelp, it is CLEAR you do not yet understand about batch parameters. You cannot "test them interactively from the command line".

%1, %2, %3, etc are special variables that a batch file can use while it is running. They can't be set by the user as you tried to do.

Consider the following batch file which we will call param.bat.

Code: [Select]@echo off
echo parameter 1=%1
if "%1"=="cat" echo a %1 says Meow!
if "%1"=="dog" echo a %1 says Grrrrr!
if "%1"=="" echo no parameter passed

Save it into a folder as param.bat

Now open up a command window in that folder.

at the prompt type :

Code: [Select]param cat
then type

Code: [Select]param dog
then type

Code: [Select]param
Now do you see?

Dias,
Thanks I had already figured that out with erobby response.

Anyway. In case you didn't realized it, the tone of your reply was rude and disrespectful. While we would appreciate you responding to our post, I don't believe you're obligated to answer anyone post if you don't feel like it. I believe many people here are asking questions because they don't know or not sure how it should work.

Next time you decide to response to a post keep this in mind, try to show some respect to your fellow forum members. I am sure what you know can be learned by anyone. The fact that we don't know/understand it yet, doesn't mean we are idiot.


quote author=Dias DE verano link=topic=62085.msg394315#msg394315 date=1216883718]
Quote from: LookingForHelp on July 23, 2008, 08:22:07 PM
erobby,
I tested that interactively via the command line, it didn't work.
1) set %1=parameter that will be passed
2) echo %1 or %%1 or %%1% , see the result below:
Code: [Select]C:\Documents and Settings\>set %1=parmtopass

C:\Documents and Settings\>echo %1
%1

C:\Documents and Settings\>echo %%1
%%1

C:\Documents and Settings\>echo %%1%
%%1%

lookingforhelp, it is clear you do not yet understand about batch parameters. You cannot "test them interactively from the command line".

%1, %2, %3, etc are special variables that a batch file can use while it is running. They can't be set by the user as you tried to do.

Consider the following batch file which we will call param.bat.

Code: [Select]@echo off
echo parameter 1=%1
if "%1"=="cat" echo a %1 says Meow!
if "%1"=="dog" echo a %1 says Grrrrr!
if "%1"=="" echo no parameter passed

Save it into a folder as param.bat

Now open up a command window in that folder.

at the prompt type :

Code: [Select]param cat
then type

Code: [Select]param dog
then type

Code: [Select]param
Now do you see?


[/quote]Lookingforhelp, you are the rude and disrespectful one! I think you should modify your attitude. My post was clear and helpful. Having read your post, I think your English is maybe not good enough to understand that I was not being rude.
6853.

Solve : Assigning IP in DOS mode?

Answer» http://
Hey guys, I WANT to ASSIGN IP Address in DOS mode MAY be it any windows OS. Please help if U know a BIT too...
6854.

Solve : dos serial/USB redirect?

Answer» HELLO All:
I am USING an old TURBO Pascal code program that requires a touch-window for input. The program has been updated and the newer version runs on our Windows XP machines (in the DOS simulator), but the serial touchwindows (that it was written to work with) won't work on the XP machines. We bought a newer USB touch-window which works wonderfully on the XP computer, but haven't gotten it to work with the older program. I've been looking for a redirect that would allow the program to work with the USB touch-window but so far haven't found anything that works. Does anyone know of any redirects that will work for this application? Or do you know of any companies that would be able to write a custom program for this application?
Thanks,
Carrie no sorry DOS doesnt work with USB only with serial but i think Ghostdog(one of the mems here) could help you make a VBS script to do this.Quote from: macdad- on July 21, 2008, 04:32:10 PM
. . . i think Ghostdog(one of the mems here) could help you make a VBS script to do this.

Ghostdog,
If this is true, and you are interested in the job, please let me know.
Thanks
6855.

Solve : PING Command Doesn't Work??

Answer»

I have this PING batch file.

ping 168.94.171.219 > nul
IF ERRORLEVEL 1 GOTO offline
IF ERRORLEVEL 0 GOTO online

:offline
ECHO offline
GOTO end

:online
ECHO online
GOTO end

:end
ECHO Goodbye

However the result that I got is only

C:\Documents and Settings\admin\Desktop>ping 168.94.171.219 1>nul and cursor blinking below it.

What did I do wrong?what is your connection speed? do you have a firewall blocking ping?
it works for meThe firewall if off and the connection is DSL.ping -n 1 168.94.171.219
IF ERRORLEVEL 1 (
GOTO offline
) else (
GOTO online
)I expect Best Buy doesn't respond to ping requests. Choose somewhere else like www.google.com or www.bbc.co.uk

1. ping from my computer

Quote

C:\>ping 168.94.171.219

Pinging 168.94.171.219 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 168.94.171.219:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)
.

2. tracert from my computer (Bristol, England, UK). Gets to ge-3-1.hsa2.Minneapolis1.Level3.net and that's all.

Quote
C:\>tracert 168.94.171.219

Tracing route to 168.94.171.219 over a maximum of 30 hops

1 15 MS 9 ms 7 ms 10.9.192.1
2 10 ms 8 ms 8 ms 62.30.64.35
3 9 ms 8 ms 9 ms aztw-t3core-1b-ge-010-0.network.virginmedia.net [80.1.240.129]
4 11 ms 10 ms 9 ms bir-bb-b-so-110-0.network.virginmedia.net [213.105.175.161]
5 15 ms 13 ms 13 ms man-bb-a-so-230-0.network.virginmedia.net [62.252.192.85]
6 20 ms 17 ms 15 ms 212.187.136.125
7 28 ms 18 ms 17 ms ae-4-4.ebr1.London1.Level3.net [4.69.133.102]
8 28 ms 35 ms 17 ms ae-1-100.ebr2.London1.Level3.net [4.69.132.118]
9 93 ms 90 ms 89 ms ae-44.ebr1.NewYork1.Level3.net [4.69.137.78]
10 92 ms 87 ms 89 ms ae-91-91.csw4.NewYork1.Level3.net [4.69.134.78]
11 85 ms 90 ms 89 ms ae-92-92.ebr2.NewYork1.Level3.net [4.69.134.93]
12 110 ms 108 ms 109 ms ae-2.ebr1.Chicago1.Level3.net [4.69.132.65]
13 106 ms 105 ms 106 ms ae-1-51.bbr1.Chicago1.Level3.net [4.68.101.1]
14 118 ms 116 ms 115 ms so-3-0-0.mpls2.Minneapolis1.Level3.net [64.159.4.214]
15 118 ms 115 ms 115 ms ge-3-1.hsa2.Minneapolis1.Level3.net [4.68.112.6]
16 * * * Request timed out.
17 * * * Request timed out.
18 * * * Request timed out.
19 * * * Request timed out.
20 * * * Request timed out.
21 * * * Request timed out.
22 * * * Request timed out.
23 * * * Request timed out.
24 * * * Request timed out.
25 * * * Request timed out.
26 * * * Request timed out.
27 * * * Request timed out.
28 * * * Request timed out.
29 * * * Request timed out.
30 * * * Request timed out.

Trace complete.

3. www.who.is says:

Quote
OrgName: Best Buy Co., Inc.
OrgID: BBC-19
Address: 7601 Penn Avenue South
Address: NONE
City: Richfield
StateProv: MN
PostalCode: 55423-3645
Country: US

NetRange: 168.94.0.0 - 168.94.255.255
CIDR: 168.94.0.0/16
NetName: BESTBUY
NetHandle: NET-168-94-0-0-1
Parent: NET-168-0-0-0-0
NetType: Direct Assignment
NameServer: DBRU.BR.NS.ELS-GMS.ATT.NET
NameServer: DMTU.MT.NS.ELS-GMS.ATT.NET
Comment:
RegDate: 1994-03-01
Updated: 2006-04-17

RTechHandle: DA27-ORG-ARIN
RTechName: Domain Administrative Contact
RTechPhone: +1-612-291-1000
RTechEmail:

OrgTechHandle: KLS26-ARIN
OrgTechName: Seamans, Kevin Lee
OrgTechPhone: +1-612-291-1000
OrgTechEmail:
Most companies block ICMP packet to prevent PEOPLE from discovering devices on thier network
6856.

Solve : batch file output to text file?

Answer»

I have been searching for 30 minutes and I can't believe I haven't found an answer YET. MAYBE I have and just don't know it. How do I OUTPUT the entire contents of a batch file to a text file? Is the only way to use the ">" command at the end of each command? Thanksa batch file is a text file, therefore its contents are already in a text file.
I didn't word my question carefully enough. I want to redirect the entire output of a batch file to a text file. Sorry for the confusion. call the batch file thus

mybatch.bat > textfile.txt
I want want the code to be internal to the batch file. I will not be using the command line to run the batch file. Ah. I see. Cannot be done. Only way is to end each line with > (txtfile)

Or duplicate lines - one for screen and one for file.
Code: [Select]@echo off
@(
echo.txt1
echo.txt2
)>a.txt
for /F "tokens=* delims= " %%F in (a.txt) do echo %%F
pause >nuli dunno what you want to do but i think i understand itQuote from: devcom on July 30, 2008, 09:34:10 AM

i dunno what you want to do but i think i understand it

I don't think you do.

Quote from: mern1
I want to redirect the entire output of a batch file to a text file.

Quote from: mern1
I want the code to be internal to the batch file.
6857.

Solve : dir command - the system cannot find the path specified????

Answer»

for win xp-pro, on a work pc, not sure all the configuration that has been set by big company, eds

in my dos window, no matter where i'm at, even c:\, the 'dir' command always returns 'the system cannot find the path specified'
please believe me, i am not crazy, and have been using dos ever since the first dos and have issued 1000's of dir commands on EVERY windows o/s.

there is some sort of config parameter somewhere that is blocking or not allowing perhaps the most basic dos command of all not to work?
ANYBODY see this? googling so far has not FOUND anything
bobJust a thought, but do you have a variable dircmd set in the environment?

that was it, thanks very much, mine was set to a bogus .CMD file
not sure how it got there, will have to check after next reboot and what ini thing sets those up.
looks like a great TOOL when used rightfirst make sure c:\windows\system32 is in your path statement or it may show as %systemroot%\system32

Second I don't know if it was a typo but what you entered had a comma after C:\

Dir is an internal not external so it only need the path to command.com or cmd.exe

6858.

Solve : Batch file to copy dynamically made files?

Answer»

Hi. I have folder which are made dynamically and i wanted to copy the contents in them to another destination. The folder themselves only have one .txt file in them so that will be easy. However, to get into the right folder is what has me confused. The folders are named like....

2005-04-18
2005-04-19
2005-04-20

and the folder i want to open is the last one but the date on it is yesterday's. So i was thinking maybe to treat those as strings or something and sort them somehow. I have never programmed a batch file other than real simple ones so i have no clue how to do this.

the command i'm gonna issue in cmd is...

copy "c:\dated logs\%that last folder%\*.txt" "c:\Program Files\MySQL\MySQL Server 4.1\data\syslog"

Can someone please help me!I wrote this on the fly, but it may work:

for /F "tokens=1" %%i in ('dir /a:d /b /o:-d') do (
copy "c:\dated logs\%%i\*.txt" "c:\Program Files\MySQL\MySQL Server 4.1\data\syslog"
goto endloop
)
:endloop

The goto may fail because the tag is outside the loop. Give it a try and get BACK to us if you have any problems.

Hope this helps. %%i turns out to be "New" so it can't find the path cuz it doesn't existI tried this on my machine. I don't know where the 'new' came from. It appears the dir list did not come from the 'dated logs' directory. Also what OS are you using?

If you don't want to run from the 'dated logs' directory, use a path on the dir command.

Good luck. k, i changed a little bit of things, and it does copy but it does OPPOSITE of what i need it too.

this is what i ran...

c:
cd "c:\Dated logs"
for /f "tokens=1" %%i in ('dir /a:d /b /o:-d') do (
copy "c:\Dated logs\%%i\*.txt" "c:\Program Files\MySQL\MySQL Server 4.1\data\syslog"
goto endloop
)
:endloop

also, i get the same ouput from this batch file which someone else helped me with...

c:
cd "c:\dated logs\"
dir /b /ad /o-d>c:\tempdeep.dat
set /ptempvar01=tempvar01copy "c:\dated logs\%tempvar01%\*.txt" "c:\Program Files\MySQL\MySQL Server 4.1\data\syslog"
del c:\tempdeep.dat
set tempvar01=


they both copy the first folder in the c:\dated logs folder, so that means its the oldest cuz its name is the oldest date

i need to get into the newest folder, the last folder in the c:\dated logs directoryOk, there's more than one WAY to skin a cat. the /o:-d switch causes the dir list to be reverse sorted on the date/time stamp of each directory. You can alway try /o:-n which will reverse sort on the directory name itself.

Hope this helps.

6859.

Solve : system cannot find specified file?

Answer»

Quote

Anyway, we all got royally led up the garden path

Should have stopped to smell the roses.

Quote
You should uncheck "hide extensions for known file types" in Windows Explorer folder options to AVOID any more "problems" like this one.

Or have run a dir LIST on the directory and seen what the actual file names were instead of using a qualifier that did not exist.

Sometimes the SIMPLEST things....Quote from: Sidewinder on July 24, 2008, 11:29:01 AM
Sometimes the simplest things....

Indeed.
Wow

I was expecting to see something like this in the post

set ydate=%date:~-4%
set MDATE=%date:~4,2%
set ddate=%date:~7,2%

ren hope.txt %mdate%%ydate%.txt
6860.

Solve : How do I Run a batch file before shutdown?

Answer»

Hi,

IM trying to run a SIMPLE BATCH file on shutdown on Win2000.
i.e when i click start shutdown, the bat file is executed.

Thanks

JohnYou can't use the task scheduler for this, so the best WAY is to include the shutdown command in your batch file as the last THING the batch file does.

@echo off
.
.
.
shutdown -s

Hope this helps.

6861.

Solve : That Darned Lexmark Printer?

Answer»

:-/ O.K....Here we go again. I finally got the printer installed (ir so it said), but when I check my programs...it's not there. If I try to print a document or TEST page it says there is no printer installed. I am getting extremely frustrated with this...I know people are saying I should just buy a new printer, but I cannot AFFORD it right now. Why WOULD the installation process say it installed successfully & I can't print. I have the printer set as my default & everything. It just does not show up in the programs installed.Sounds like a mess of problems. Since you're running XP, doing a system restore to just before you tried to install the printer would be a good idea.

Autoexec.nt:

If this file is corrupt, you can get it back from the repair directory:

copy c:\windows\repair\autoexec.nt c:\windows\system32

This problem SEEMS pretty common, so after the copy, find the copied file in Windows Explorer, right CLICK, then Properties and tick the read-only atrribute, then Ok

Now the printer:

You can download a XP driver from:

http://downloads.lexmark.com/cgi-perl/downloads.cgi?ccs=229:1:0:432:0:0&emeaframe=&target=http://downloads.lexmark.com/cgi-perl/downloads.cgi&target=http://downloads.lexmark.com/cgi-perl/downloads.cgi&&req=:::::.

Connect the printer to the PC, install the driver, then reboot. Everything should be Ok. You can also check around the site above and see if you need anything else like software for controlling your printer.

Good luck.

6862.

Solve : Special Char?

Answer»

how can i set all char ([emailprotected]#$%^&*()_+}{"|:<>?/.,\';][=-) to a each other variable and then echo them??
i've tryied this:
Code: [Select]C:\Users\Vaio>set a=&
C:\Users\Vaio>echo %a%
%a%
C:\Users\Vaio>set a=^&
C:\Users\Vaio>echo %a%
ECHO is on.
C:\Users\Vaio>set a=!
C:\Users\Vaio>echo %a%
!and in for LOOP. No one of them was working.
Does any body know ?


Most of those characters have to be escaped, like your 2nd SET command. Some of them also have special MEANING in the command prompt, so they would need to be quoted or escaped or combined with other characters. TRY this:

Code: [Select]set a=^&
echo "%a%"
echo ^%a%OK but how to:
Code: [Select]set a=^&
set m=%m%^%a%
echo %m%
it doesnt WORK at allQuote from: devcom on July 29, 2008, 06:09:04 AM

ok but how to:
Code: [Select]set a=^&
set m=%m%^%a%
echo %m%
it doesnt work at all

It does work but you omitted to escape the echo line i.e. echo ^%m%

no it doesnt, i have vista and this may be a problem
Code: [Select]C:\Users\Vaio>set a=^&
C:\Users\Vaio>set m=%m%^%a%
C:\Users\Vaio>echo ^%m%
%m%
C:\Users\Vaio>echo %m%
%m%
C:\Users\Vaio>echo %a%
ECHO is on.
C:\Users\Vaio>echo ^%a%
&
and i would repeat this commandCode: [Select]set m=%m%^%a%100 times, so %m% must look like hudert of '&' (just example)
6863.

Solve : found another way to append?

Answer»
im using xp pro, try this i didnt know you could do this TILL a minute ago while i was messing around

2^> FILENAME FIRSTLINEOFTEXT

then TYPE type filename

and you can clear the file, by typing

1^> FILENAME Meaninglesstext


it is ALSO possible to call on a batch file like this..
by default if you type i^> it shouldnt do anything
so if you made a .CMD file called id.cmd , that echoed %1 %2 %3 %4
you could instead type i^> 1 2 3 4 if you switch the folder you have id.cmd innow that kewl diablo
6864.

Solve : timestamp delta?

Answer»

Hello

I have a BATCH file running few PROCESSES and I would like to obtain the total time in millisecondes of the processes at the end of the batch.
I would like to have it printed on the screen.
How can I get this delta (t2- t1) in my batch? :-/

Sincerely,

Jack
Why don't you put the "time" COMMAND and the beginning and end of your file and log the output of the batch file.

myfile.bat > myfile.log

Then VIEW the log file. It won't do the math but it gets you STARTED.

6865.

Solve : How to add a empty line in a text file??

Answer»

Hi Friends,

I NEED to add a EMPTY line as the first line for a text file.......,

For example:

a.txt file contains
Old is gold
All the best


I need the output in c.txt. That o/p file should contain
-------------> Empty Line
Old is gold
All the best

Is it possible in DOS. If so will you please help me to RESOLVE this issue...,

Thanks In Advance.

Thanks,
Vinoth R
echo. > C.txt &AMP; type A.txt >> C.txt

I hope this is not homework.....

6866.

Solve : ANSI Sequences?

Answer»

Hey,

Having read a brief DESCRIPTION of ANSI sequences, I've been having trouble finding out further information. I read that it's possible to have boxes and LINES drawn in batch files and to create menu's but I've not been able to find any examples of this.

Any one got any IDEAS?

Just for info, I'm USING a full install of MS-DOS 7.10. It's the main system, not a prompt.

Thanks!Volumes of info on the WWW - here's one site for MS-Dos 7/ANSI

Good luck
make a menu using the echo COMMAND followed by use the choice command

6867.

Solve : change directory command?

Answer»

i am in ms DOS and it appears A:
how do I change to C: ?
I typed cd\ and then c: but don't work
please help
thanks a lot
More info please.

Have you booted from a floppy disk to get to A:? If so what are your trying to do?
What OS are you trying to access - if XP what file system?
Have you installed DOS on the harddisk?

What are you trying to achieve?
wow, jsut my luck I was right about to ask the exact same question.

Really all im trying to do is restart my COMPUTER into a command prompt only mode, but I have windows XP (sp2)

I tired teh hold f8 thing, but there is no pure command prompt mode on the list, the closest thing is safe mode with command prompt, which DOESNT cut it.

I TRIED to use a boot disc, but when I use that I can't get out of the A:

What do i dooooooooo?ah nevermind i dont need to know anymore, id erase my post but i cant since im not registered. Thanks anyways!Well Gabe if you really want C: at the command prompt hit start/run and enter cmd in the box. If you then want full screen hold Alt and hit enter (and again to minimise when you want to to go back)

Good luckHi Dina3 or Gabes n every1,

the command to change directory in DOS is :
c:

Not cd.

Cheers

6868.

Solve : Ms-Dos boot partition to set up windows?

Answer»

how do i CREATE an Ms-Dos BOOT PARTITION to SET WINDOWS while in Ms-dos

6869.

Solve : Re: cd into a Directory with spaces?

Answer»

Can you please explain what operating system.......you have.try again and ..............repost........arguement of command problem.s.Hi exchaoordo,

R u running DOS using cmd or command? If u use cmd, u don't need to care ABT the spaces. U can type the folder name with the spaces and u willl be ABLE to cd into that dir.

Anyway if u r using command then add the apostraphe, example : cd "\programs\start MENU"

N double check that ur directory name EXIST, do a dir listing.

Cheers

6870.

Solve : Opening Access 2000, using a .bat?

Answer»

I want to open an access database using a batch file (simple ENOUGH) but the security WARNING is stopping the Db from opening fully. Does anyone now how to bypass the warning without lowering the security level?That's why it is there. If you disable it from a command line for a single instance it sort of defeats the PURPOSE of taking the time to put it there in the first place.Anyone got any usefull idea'sWonder if I should take offense at that? :-/

TRY here....

http://www.dbforums.com/f84Thank you. I'll check it out

6871.

Solve : MS-DOS Boot disk problem?

Answer»

hey hey,

i have a problem....

on my pc currently running windows XP i created a dos bootable floppy disk.

I restarted my pc and up dos comes. GREAT i thought.

But at when i tried to access the C drive from DOS I found I couldn't any ideas why and how to get round this?

any help greatly appreciated,

Ian DuffyHi Ian,

I believe the problem is that ur winXP resides on NTFS partition, while DOS bootdisk can only see FAT partition.

There are MANY types of partitions. DOS, win95, win98 usually use FAT. WIN2000 can use both FAT and NTFS.

I suggest u try to create an NTFS bootdisk - try searching google or this site http://www.ntfs.com

Alternatively, try use ur winXP CD (it is a bootable CD) to boot up ur computer.


Cheers

6872.

Solve : Expanding and looping over paths?

Answer»

Hi. I'd like to make a batch file that loops over a semicolon separated path variable and displays each directory on a different line. I am having 2 problems trying to do this:

1. I am passing in the name of the path variable to loop over ("path", "classpath", etc). How can I expand that path in a variable. For example, in my batch file, %1 = "path". How can I assign the contents of %path% to a variable. I don't want to test if "%1" = "path" as I want this to be flexible enough to handle any path variable (I have a lot of them).

2. How can I loop over a semicolon separated string and display each path on a separate line. I've been playing with "for /f" quite a bit, but haven't figured out how to manipulate the tokens and delimiters keywords.

Thanks!You MEAN something like this?

for /f "delims=;" %%a in ('echo %path%') do echo %%a >> pathlist.txtSort of. When I substituted this into my macro, I got a file where all the paths were on a SINGLE line and separated by a SPACE:

c:\dir1 c:\dir2 c:\dir3...

What I want is a listing on my console where each path is on a separate line:
c:\dir1
c:\dir2
...

Also, if %1=PATH, what would the echo look like? How would I GET the contents of the path variable. For example:

displaypath path
c:\dir1
c:\dir2
...

This would set %1="path" in "displaypath". How do I get to the contents of path?
Thanks!Your problem is that the /F switch tells FOR to treat whatever is in the parentheses as a SEQUENCE of lines, and the PATH environment variable string is just one line. What you can do is replace every semicolon with the sequence quote-space-quote so that FOR can chop up the line. Then you can use the ~ variable modifier to dequote the substring. Or not as the case may be.

This code parses a semicolon delimited string into separate lines. The IF test is to filter out the results of multiple or trailing semicolons. For want of any better idea, I called it semi-parse.bat. The parameter passed is quoted to avoid problems with spaces.

Code: [Select]@echo off
set string=%~1
for %%A in ("%string:;=" "%") do (
if not "%%~A"=="" echo.%%~A
)
Code: [Select]C:\>semi-parse.bat "apples;pears;oranges"
apples
pears
oranges

C:\>set teststring=shoes;gloves;hat and coat

C:\>semi-parse.bat "%teststring%"
shoes
gloves
hat and coat

C:\>set teststring=mother;;father;sister;brother;

C:\>semi-parse.bat "%teststring%"
mother
father
sister
brother

C:\>semi-parse.bat "%path%"
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem

C:\>Thank you both. This is very helpful! It basically solves my problem and with a little tuning will be exactly what I wanted.

6873.

Solve : Delete files older than?

Answer»

Need a simple DOS BATCH program which deletes files older than a certain date.You can do this indirectly with XCOPY using the /d:mm-dd-yy switch. Use XCOPY to copy all the files you want to keep to a temp directory. Delete all the files in the original directory, then move the copied files back. Finally delete the temp directory. Use XCOPY /? at the command line for details on the /d switch.

Messy but effective.

Hope this helps. Thank you but a bit messy. I really wanted code like the following.

erase c:/dirname/*.* where time &LT; 7days

Just need the right syntax

Thanks
NormThen you need to use VB Script not DOS Batch.Quote

I really wanted code like the following.

erase c:/dirname/*.* where time < 7days


[SIGH] wouldn't we all!

Not as messy but still effective:

Dim FSO, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec) ' <== Change folderspec to your requirements (put in quotes)
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateLastModified, Now) > 7 Then
fso.DeleteFile(f1)
End If
Next
Set fso = Nothing
WScript.Quit


Note: you can also use the DateCreated or DateLastAccessed properties

Save as a VBS file, then DOUBLE click file to run.

Good Luck. Thank you both for your help.
I will give it a go.
Normhello,

maybe this can help u :

for /F "tokens=1,2,3,4,5* delims=/ " %a in ('dir') do if "%c%b%a" LSS "20050420" echo %f

6874.

Solve : How to combine two text file using Dos??

Answer» HI Friends,

I need to combine two text file to one file.

For EXAMPLE:

a.txt file contains
Old is gold
All the best


b.txt file contain
World war
Happy bday


I need the output in c.txt. That o/p file should contain
Old is gold
All the best
World war
Happy bday



Note: When I tried with the command COPY a.txt+b.txt c.txt
which gives o/p as
Old is gold
All the bestWorld war
Happy bday


Actually I need the "World war" should ADD in new line...

Is it possible in DOS. If so will you please help me to resolve this issue...,

Thanks In Advance.

Thanks,
Vinoth R



Type A.txt > C.txt &AMP; echo. >> C.txt & type B.txt >> C.txt

6875.

Solve : Prompt for variables?

Answer»
Hi,

Can someone tell me if there is a WAY I can prompt for a VARIABLE to be input by the user while RUNNING the BATCH script?
Doesn't seem to be anything around - for NT OS, either that or I've just forgotten how!

Thanks,
Jason.
6876.

Solve : Bach Programming Help?

Answer»

Hello,

I want to use a case structure with a batch file, but I don't KNOW how to work with variables.

I know it should look something like this:
Quote

show(Press 1 if you want to do A, 2 if you want to do B)
:label0
get X
if x==1 then goto label1
if x==2 then goto label2
ELSE show(invalid number, try again)
goto label0

:label1
[do A]
goto label_end
:label2
[do B]
goto label_end

:label_end


But I can't get how I create/define/make variables and how I get the INPUT value for that variable.

Could someone help me, please ?

obs:
Using Comand Prompt from WinServ2k3
:label0
::use set /p to get input, example
set /p x=Enter your CHOICE:
if "%x%"=="1" Goto Label1
if "%x%"=="2" Goto Label2
cls & echo You have made an invalid choice & Goto label0

:label1
:label2
Thanks!

Lemme just ask another question:
What is the difference between this:

Quote
cls & echo You have made an invalid choice & Goto label0

....and this:
Quote
cls
echo ...
goto label 0
?there isnt one, using & is the same as starting a new line so it LOOKS like
cls & echo You have made an invalid choice & Goto label0 but its really

cls
echo you have made an invalid choice
goto label0


Ahh! I tought it was something like that =)!

Thanks again!
6877.

Solve : set DOS to choose random, or one by one?

Answer»

i need something LIKE this:
Code: [Select]set /p URL
FIREFOX.exe %URL%
taskkill IM firefox.exe
the firefox.exe, its in my directory so it opens it and enter the URL

but now, the thing is for the url, im going to put about 20 urls, and i don't want to set the command for all of them, if theirs a better way?

if u didn't understand what i said, read here:

i want the CMD randomly or from up to down, go on url, with out me putting fire fox www.blablah.com, just one firefox command,and a list of urls , so like:
Code: [Select]firefox
www.fsdr.com
www.gfb.com
www.vbzdfs.comdo i wouldn't have to put:
Code: [Select]firefox www.fsdr.com
firefox www.gfb.com
firefox www.vbzdfs.comfor the rest i know wut to do, just this part

from my LOOK its impossible

6878.

Solve : boot diskette?

Answer»

After i inserted the BOot Diskette appeared
starting Windows 98
A:\
What is the command that i MUST Type to start Windows and ti not lose what i had in my PC
Please tell me!!!to not lose anything .......load the win98 cd ...and chose the browse option next click the pws folder........next the add-ons folder........now sroll down the page ......till you come across an ICON called regsvr32.........next to it is one called setup........if you were to click this icon it will re-install win98 without any files lost.......what is your PROBLEM more info the BETTER........

6879.

Solve : Wscript/cscript help?

Answer»

Hi all!

I have a small question:

How would i go about AUTOMATING mouse clicks sing a .vbs file?

I know that the following saves a notepad file, but how can i use the same language and method to make the mouse click?

Code: [Select]set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 10
WshShell.AppActivate "wordola.txt"
WScript.Sleep 10
WshShell.SendKeys "%"
WScript.Sleep 0.1
WshShell.SendKeys "{DOWN}"
WScript.Sleep 0.1
WshShell.SendKeys "{DOWN}"
WScript.Sleep 0.1
WshShell.SendKeys "{DOWN}"
WScript.Sleep 0.1
WshShell.SendKeys "~"
WScript.Sleep 10

Thanks in Advance,

kamakyou can read more here http://msdn.microsoft.com/en-us/library/aa922603.aspxQuote from: diablo416 on July 25, 2008, 08:25:18 AM

you can read more here http://msdn.microsoft.com/en-us/library/aa922603.aspx

How would i implement that into a .vbs file like my example above?Quote
How would i implement that into a .vbs file like my example above?

You probably wouldn't unless you've gone mobile!

Consider which control has focus; then consider how many times you have to HIT the TAB key to give the control in question focus. Once the the control has focus, send the enter key (same as a mouse click in this context).

Microsoft might have had a great editor if they'd made notepad scriptable. Instead only the CLUNKY sendkeys method seems to work. You can make menu choices with sendkeys by using alt+underline letter (atl-f for file or alt+e for edit etc) to grab the menu, or use the menu shortcuts to do things like save (ctl-s) or paste (ctl-v), etc.

Are you sure the WshShell.AppActivate "wordola.txt" is correct? That does not appear to be the window title for notepad.

6880.

Solve : FILENAME WITH CURRENT DATE?

Answer»

hi people.

i need to know how can I create a text FILE with current DATE as filename.

like this: 03092005.txt

help me PLEASE
THANKS a LOT!!http://www.robvanderwoude.com/index.html

6881.

Solve : converting hex filenames to decimal in batch file?

Answer»

Hello All,

I was wondering if there is a simple batch command that will go into a dir and convert all the filenames in hex to decimal.

Some example filenames:
0000->0000
1000->4096
AAAA->43690

THANK you for your time,
PeterQuote from: spiderboy on July 25, 2008, 12:55:15 PM

Hello All,

I was wondering if there is a simple batch command that will go into a dir and convert all the filenames in hex to decimal.

I'm not aware of any batch command that can do this. You can do this is VBScript HOWEVER:

Code: [Select]Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set f = fso.GetFolder("c:\temp") 'change directory here
Set fc = f.Files

For Each FS In fc
fname = fso.GetBaseName(fs)
fext = fso.GetExtensionName(fs)
newName = CLng("&H" & fname) & "." & fext
fs.Name = newName
Next

Save with a VBS extension and run from the command line as cscript scriptname.vbs

You may have to change the directory name.

Good luck. Thank you Sidewinder. batch can do this directly.

set /a TREATS numerical strings beginning 0 as octal (pitfall for the unwary!), and those beginning 0x as hexadecimal.

Code: [Select]@echo off
setlocal enabledelayedexpansion

echo abc > 0000.txt
echo def > 1000.txt
echo ghi > aaaa.txt
echo jkl > 000f.txt
echo mno > 00ff.txt
echo pqr > 0fff.txt
echo stu > ffff.txt
echo vwx > aef2.txt

for /f %%H in ('dir /on /b *.txt') do (
set hexstring=%%~nH
set extension=%%~xH
set /a decstring=0x!hexstring!
set pad=
if !decstring! leq 9999 set pad=0!pad!
if !decstring! leq 999 set pad=0!pad!
if !decstring! leq 99 set pad=0!pad!
if !decstring! leq 9 set pad=0!pad!
set decstring=!pad!!decstring!
echo !hexstring!!extension! =^> !decstring!!extension!
)


Code: [Select]0000.txt => 00000.txt
000f.txt => 00015.txt
00ff.txt => 00255.txt
0fff.txt => 04095.txt
1000.txt => 04096.txt
aaaa.txt => 43690.txt
aef2.txt => 44786.txt
ffff.txt => 65535.txt
6882.

Solve : moving files?

Answer»

I want to move TXT files depending on their date created, using a batch FILE. Any suggestions?Hi.
Hope this will help get ya started.

dir *.txt /b/o:d > ordered.lis

for /F "eol=' tokens=1*" %%i in (ordered.lis) do set NEWEST=%%i

move newest drive\dir\newest

This will get the newest VERSION of a file by date.


Mark....

6883.

Solve : Copy/replace batch file?

Answer»

Hi all,
I'm TRYING to write a batch file that copies a file from a network location, and pastes it to a local directory. I've tried this, but it doesn't seem to work:

@echo off
copy \\servername\foldername\subfoldername\filename C:\Program Files\foldername

should copy from SERVER location and paste to c:\ location... but doesn't seem to.

Thanks!
MitchHave you tried

copy "\\servername\foldername\subfoldername\filename" "c:\Program Files\foldername\"

?
Yup that was it. Didn't know I needed the quotation MARKS...

Thanks!!!!

6884.

Solve : Batch file help-xcopy command perhaps??

Answer»

First off... ello! Great to have a community like this!

I'll try and explain this as simply as possible and provide as much detail as I can.

I am CREATING an application CD to house a bunch of applications that I use on a routine basis. I have no trouble with any of the applications. The issue I am having is with external plugins or other dll's to add into the applications. 99% of the time, I will be installing this on a WindowsXP INSTALL.

My thought was to create a batch file to copy the contents of a directory on the CD into a situation like this: C:\Program Files\Stupid Program\Plugins

Now, here's the issue.... Since this will be a CD that I might want to install on multiple PCs, using XCOPY, the source might be different (ie. DRIVE "D:\" being the default CD drive usually).

Is there a command that will allow me to utilize the CD drive DEPENDING upon it's drive designation or perhaps prompt the user to input the CD drive letter & use that to copy over the contents? If so, would it be possible to post a sample of the commands? I'm a newb to advance batch file functions, so please be nice

Thanks in advance for your time & help!The possibilites are endless.

You can use brute force and simply pass the CD drive letter along the command line (ex: myfile CDROMdrive). Use the %1 variable in place of the hardcoded drive letter in your batch file.

You can use the KISS method and have the batch file prompt you for the drive (ex: set /p cdrom=Enter drive letter of the CD). Use the %CDROM% variable in place of the of the hardcoded drive letter in your batch file.

You can use the Is This Cool Or What? method and write a Windows Script, loop over the drives collection, find the CD device type, extract the corresponding drive letter and use that in place of a hardcoded drive letter.

Personally, the KISS method generally is the way to go.

Good LUCK. Thanks for posting Sidewinder!!! Appreciate that!

The KISS method is what I figured I'd need to utilize to accomplish this. There is noooo way I'm going to touch Windows scripting right now unless there is a compiler that guides you through composing one.

So, in essence, this should work for me then? (keep in mind, i'm just looking for the function of copying the directory from the cd to the plugin directory on the hard drive).

Code: [Select]
set /p userin=Please Enter Your CD-rom Drive Letter and Press Enter:

xcopy /s %userin%:\plugins C:\Stupid Program\Plugins


Appreciate the time once again!Your code will work just fine. BTW: Windows Script does not need a compiler. It's interpreted, and the interpreter is included with all flavors of Windows.

6885.

Solve : Trying to write a batch file?

Answer»

I have to write a AUTOMATED batch file that will grab logs (ex05051500.log) that I want to zip up and move to another DIRECTORY.

-need to be able to grab certain files depending on their file name to be zipped?

-need only the first 8 letters or numbers in the file name to be USED as the ending file name (i.e. ex050515.zip)?

Please if anyone can help...

More info is needed. What OS are you using? What Zip program are you using?

Quote

need to be able to grab certain files depending on their file name to be zipped

What is the criteria for selecting a file? And finally can you script this instead of using batch?

Let US know. it is WinXp, and using Winzip 9.0Ok! here we go:

First we need a list of the files to select, I'm gonna assume they are *.log files.

for /f %%i "delims=. tokens=1-2" in ('dir /b *.log') do (

Next we need to parse out the first 8 characters of the file name (be sure this doesn't create dups)

set /p Fname8 = %%i :~0,8%

Then it's time to zip them:

wzcline drive:\path\%Fname8%.zip %%i.%%j

wzcline is the batch version of WinZip

Okay!, shut it down with )

If you read between the lines, it's all it front of you.

Good luck. I greatly appreciate your help, I have been so lost the past few weeks trying to figure this out, but once agian i'm stuck with your script. I am getting an error. This is how I wrote it in the batch file:

For /F "tokens=1-2 delims=." %%i in ('E:\logs\test /b *.log') do "set /p Fname8 = %%i :~0,8%
wzcline E:\logs\test %Fname8%.zip %%i.%%j"

any ideas? I get this error:
The filename, directory name, or volume label syntax is incorrect.For /F "tokens=1-2 delims=." %%i in ('dir /b E:\logs\test\*.log') do (
set /p Fname8 = %%i :~0,8%
wzcline E:\logs\test\%Fname8%.zip %%i.%%j
)

I'm a LITTLE unsure about the set statement; it may need an addtional % after the equals sign. You can play around with it.

I can't emphasize enough to consider script for these types of tasks. The above code is nearly unreadable and it certainly won't get any clearer in six months time.

In case you don't have the batch version of WinZip (wzcline), here is the link: http://www.winzip.com/wzcline.htm

Hope this helps. thanks for your help-
6886.

Solve : New person in this site and am student in programming?

Answer»

Dear EVERYONE,

Please, I like to know more about the programming because am flesh STUDENT in Progrmming language which just started in few days ago. I wanna know more Java 6, C++ Fundamentals,Microsoft .NET FRAMEWORK 2.0, UML, FileMaker 9 & PHP Foundations, Programming With Ruby, C Programming 2007, Design Patterns, JavaScript,

Thank youQuote from: boaeben on JULY 25, 2008, 08:18:53 AM
am flesh student

Yummy

boaeben, you should be asking your teachers and reading books. Feel free to ask in the programming section if you have specific questions.
Google is a very nice teacher as well.
6887.

Solve : DOS and the Recycle Bin?

Answer»

Patio.........help!!

I accidentally deleted an msdos.sys file from the root directory. Of course my machine boots only to the C:> prompt now.

I can't believe that 6 hours of searching the Web has resulted in no productive solutions....

Problem: USING the dir c: doesn't SHOW me the Recycle Bin.. what is the filename for it?

This box is running 98SE. Not sure which version of DOS it's running.

Many thanks in advance!If you delete a file using DOS, it doesnt go to the recycle bin

However, all may not be lost, you should be able to 'undelete' it.

If your machine is not bootable now, go to bootdisk.com and download a DOS image, run it to expand it (you will need a 1.44Mb floppy) - it will create a bootable floppy.

Leave the disk in your working computer and search download.com (other download repositories are available) for undelete. Pick one that works under DOS (pretty much any ver will do) and put it on the floppy.

Now stick the floppy in your dead pc and boot it (make sure the floppy is on the list of drives that can boot the pc). when you get to the A:> prompt, change to c: and run the undelete PROGRAM from the a: drive.

Just thinking about it, if you download the win98SE boot image, you might just be able to boot the pc with the floppy and do
sys c:
which will copy the important files to your hard disk - but try the undelete first

Good luck
GrahamGraham - thanks for the reply.

I was in Windows when I deleted the file.

I had recently started experiencing some weird computer behavior from time to time I had run all anti spyware/virus/registry fixing utilities that I own - to no avail.

So I was rooting around the root directory when I noticed 3 versions of the "msdos" file residing there.

The 3 versions were: "msdos.sys" (which is fine), "msdos.---" (that's right, the file extension was 3 dashes).. I can't remember the last strange "msdos" file's extension, but it was not ".sys" as it should be.

I checked the root directories of my other 3 machines and found no such odd files...only "msdos.sys". I thought that I could move "msdos.---" to the Recycle Bin and then move it back if there was a major problem... obviously I was wrong!

I must put that exact file back into the root directory...using DOS.

Thanks for your help.Quote from: AndyCountry on July 29, 2008, 11:44:42 AM

Graham - thanks for the reply.

I
The 3 versions were: "msdos.sys" (which is fine), "msdos.---" (that's right, the file extension was 3 dashes).. I can't remember the last strange "msdos" file's extension, but it was not ".sys" as it should be.

I checked the root directories of my other 3 machines and found no such odd files...only "msdos.sys". I thought that I could move "msdos.---" to the Recycle Bin and then move it back if there was a major problem... obviously I was wrong!

I must put that exact file back into the root directory...using DOS.


the three files were likely MSDOS.SYS, MSDOS.--- and MSDOS.SYD. As far as I am aware, only MSDOS.SYS is required to boot the computer into windows... if you have any of the three files remaining, you can copy them back into a new MSDOS.SYS (or MSDOS.---, or whatever file you deleted by accident).

I don't know your skill level in DOS, but the copy command will suffice quite well:

Code: [Select]COPY C:\MSDOS.SYS C:\MSDOS.---

of course, replace the first filename with one of the MSDOS.* files you haven't deleted, and the second name with the one you have deleted.


If you've deleted all three- you can easily create a new one. in Windows 95 and up, MSDOS.SYS (and the backup copies MSDOS.--- and MSDOS.SYD) are simply text files used by the boot loader.

I'll just transcribe the contents of the MSDOS.SYS file on my old laptop (circa 1996) assuming of course- it still boots. hasn't been used in the better part of a year. I've been meaning to clean it up anyway, so it's not out of the way at all


alright- I've got the contents of the MSDOS.SYS file, you should be able to save this into a new MSDOS.SYS file (using the EDIT program on the target computer). If you're booting windows from a drive or folder other then C:\WINDOWS, you'll need to change the respective options.
Code: [Select][Paths]
WinDir=C:\WINDOWS
WinBootDir=C:\WINDOWS
HostWinBootDrv=C

[Options]
BootMulti=0
BootGUI=1
;
;The following lines are required for compatibility with other programs.
;Do not remove them (MSDOS.SYS needs to be >1024 bytes).
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxa
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxb
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxd
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxe
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxg
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxh
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxj
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxk
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxl
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxm
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxn
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxo
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxp
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxq
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxs
DoubleBuffer=1
AutoScan=1
WinVer=4.10.2222



that should get you booting into the GUI again. Now that I think about it, you could have simply copied MSDOS.SYS from one of the other computers you've looked at to your ailing one.


With all this in mind- can you start windows from the prompt it presents you by typing WIN ?Thanks Graham,

I put the msdos file that you wrote out for me (thanks) onto a floppy (naming it "msdos.---") and then copied it into the ailing machine's c: drive.

Then rebooted, but it still goes to the C:> prompt.

Still woking with the floppy, I then change the name of that "msdos.--- " file to just "msdos.sys" and tried copy it over to the c: drive and was asked if I wanted to overwrite "msdos.sys"? I said yes, then was given :

"access denied - c:msdos.sys"
0 file(s) copied

Question: Shouldn't it have asked me if I wanted to overwrite "msdos.---" ?? I get the feeling that the .--- file extension is a wildcard of some sort?

Using "Dir" command shows that the "msdos.---" file is there. Not msdos.sys or ANY other msdos files.... yet I know for a fact that there was an "msdos.sys" and a 3rd "msdos. " file in the root before this "event" occurred.

Hidden files in play here?


I next took a known good version of this msdos.sys file from another machine, as you suggested and copying it to the ailing machine's root... but my machine won't add another msdos file, it only wants to overwrite the existing, with the above referenced results.

What is the syntax for deleting that msdos.--- file from the root directory?


Thanks againIs there a full ver. (probably 6.2) installed on this machine ? ?
If so put floppy #1 of MSDOS in and at the A; prompt type in sys C:\ and hit Enter...Quote from: AndyCountry on July 29, 2008, 02:27:30 PM
Thanks Graham,

That was my post... you can blame him if it doesn't work, though.

Quote from: AndyCountry on July 29, 2008, 02:27:30 PM
Thanks Graham,



Question: Shouldn't it have asked me if I wanted to overwrite "msdos.---" ?? I get the feeling that the .--- file extension is a wildcard of some sort?

Using "Dir" command shows that the "msdos.---" file is there. Not msdos.sys or ANY other msdos files.... yet I know for a fact that there was an "msdos.sys" and a 3rd "msdos. " file in the root before this "event" occurred.

It wouldn't of asked you to overwrite MSDOS.---, since the file obviously didn't exist. No it is not a wildcard char, only ? and * are wildcard characters.

MSDOS.--- is likely a system-created backup of MSDOS.SYS, MSDOS.SYD (my guess as to the third filename extension) is created GOD knows when, and isn't used to begin with... MSDOS.SYS is hidden, and will only show up with a dir switch:
Code: [Select]dir C:\ /ah


anyway- MSDOS.SYS is always hidden on drive C:, which makes me wonder how you deleted it in the first place. I don't see how that caused a problem. instead, you might have an easier time editing your existing MSDOS.SYS file, to check for the existence of the BOOTGUI option. booting from the C:\ drive into the command line and running EDIT MSDOS.SYS should enable you to view the current settings. If BOOTGUI=0, change it to 1, and your problem should be solved. Otherwise, we'll try replacing it with a known-good version (the one I provided, assuming your Windows dir is C:\WINDOWS).


first, you'll need to make the MSDOS.SYS file on C:\ non hidden. It's also set to System, so we'll need to do it in one fell swoop, otherwise the attrib command will whine:

Code: [Select]attrib C:\msdos.sys -s -h
(I'm a bit rusty, but if it says "not resetting ...." just flip around the -s and -h in that command.)

now that MSDOS.SYS is visible, you can rename it (say, MSDOS.OLD) and copy over the MSDOS.SYS file from the floppy. With any luck, that will work.

Somehow your MSDOS.SYS file that is currently on your HD possesses the "BOOTGUI" option set to 0, or at least that is my guess.

EDIT: patio's suggestion might help, if we forget that the machine is actually running windows 98SE which uses MSDOS.SYS for configuration data, as opposed to MS-DOS 6/6.2's MSDOS.SYS file that contains machine code.
BC........many apologies for not noting you were the person responding to me.

What is the emoticon for "very embarrassed"??


I thank you for your time and patience. I used your "attrib ......" command to allow me to see the hidden sys files when in DOS. However, I have forgotten most, if not all, DOS COMMANDS over the last 25 years (IBM AT) since I had to regularly use them, and when I went to rename the msdos.sys files, I was left scratching my head. I did eventually manage to rename both msdos files.

I copied "your" msdos.sys code over to the root of the ailing machine and all is well now. An interesting aside.....your msdos file is over 1,600 bytes yet the one native to my machine contains only 9 bytes (";WIN98EBD")... both work, which is all that counts I guess. Strange.

Thanks again BC_Programmer.

You had wondered how I deleted this file in the first place? I always enable the OS to show hidden and sys files. Perhaps I should abandon that practice




Quote from: AndyCountry on July 29, 2008, 05:09:13 PM
the one you copied over was the MSDOS.SYS from your Emergency Boot Disk, thus the ";Win98EBD". Normally there is that buffer of x's so older programs won't get confused when they see a MSDOS.SYS that is smaller then 1024k, or something, not sure about the details...


I wouldn't abandon the practice of displaying hidden/systen files, just know that when you find them, they are usually hidden for a reason




6888.

Solve : cool website?

Answer»

heres a cool website, i think it can ANSWER a LOT of questions asked on this forum, are there any other good website if you are intrested in this subject?

HTTP://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspxCommand-line reference A-Z

6889.

Solve : EMS-Memory on newer Boards for DOS?

Answer»

Hello to All!
I'll need for some MSDOS-PROGRAMS EMS-Memory. The OS is WIN XP SP2. The PIF-Settings for the programs are: 4096 KB EMS-Momory. But the program couldn't detect EMS-Memory and so it aborts.
The mainboard-manufacturer-hotline said, newer BOARDS didn't support EMS-Memory.
Is this correct?
If it is correct, did ANYONE know which mainboards support EMS-Memory.
I would agree with their support line, many newer boards do not support EMS memory.

You would have to have options in your BIOS to Disable Legacy USB support, disable on board video, use IDE not SATA drives etc.

I don't know what boards would specifically support EMS but I would probably have PS/2 port support instead of only USB, no on board video, IDE drive CONTROLLERS, etc. So basically nothing new and fancy.

6890.

Solve : log+send??

Answer»

im trying to do two THINGS,

1.make a log FILE that displayes everything it showed on command line. (it doesnt matter if the actual command are being showed or not)

2.take that log and send it as a MAIL, or MAYBE load it up to a server will be easier...

another thing, i remember spoofing an e-mail by connecting to the e-mail server, can you do that with public e-mail accounts like yahoo or msn? actually all i need to do is just send an e-mail from command prompt, WITHOUT using any program at all...

6891.

Solve : batch program help?

Answer»

OS: win 2k

I'm tweaking my batch program and need some help.

Bascially I have a .bat progam listed in a folder called "test files". All my user has to do is use the windows explorer and navigate to the test file folder and double click the .bat program.

In my batch program I'm doing

1)BACKING up one file directory by typing in "cd.."
2)next line in .bat program I type the command to compile the exe
3)next line I want to copy the complied exe back into folder "testfiles" which is a folder in the same directory as the .exe. The copy command WANTS the destination location to be an absolute PATH which I can't assume will be the same for each user depending where they place there testfiles folder.

so in the nut shell I'm trying to do this in the middle of my batch progam

cd..
dcc32 zzz.dpr
copy zzz.exe "cd testfiles"

i get a dos prompt asking do I want overwrite cd testfiles? shouldn't it be asking if I want overwrite zzz.exe if there was one in the testfiles folder? also I want to copy and overwrite the zzz.exe in all cases and be asked by a prompt.

any suggestions or help would be appreciated

thanksQuote

OS: win 2k

also I want to copy and overwrite the zzz.exe in all cases and be asked by a prompt.


mean to say not prompted
Change the LAST line to "copy zzz.exe testfiles" or "copy zzz.exe testfiles\zzz.exe" (minus the quotes).
6892.

Solve : Batch Files, Logic, and Time?

Answer»

Forgive me. I'm new to these forums, and to the Batch file deal... Grew up with computers, and if I knew about batch files back when I was a budding geek at the age of 14, I'd know what I was doing now...Only I didn't...So...

Can someone show me an example of batch file for DOS that operates only if it is a particular time of the day? I would like to create a file that uses logic, and operates only between the hours of 7:00 am and 9:00 PM... At 9:00 pm, the computer would exit the batch job... What do you think? Is this DUMB?

BTW - I have looked at your "Batch File Help" page, which has proven useful beyond belief, but I don't think this issue is addressed.

Thank you!
If this is a windows OS, you could use the task SCHEDULER. Schedule the job to start at 7AM and then on the SETTINGS TAB, have it commit suicide after running for 14 hours.

If the batch file launches a secondary program, then you would have to schedule the launched program thru the scheduler not the batch file. You could get really imaginative and have the batch file scheduled to run at 6:55AM and put the lauched program on the schedule for a 7AM start ("AT" command)

If this is a DOS machine, then there is no scheduler and batch language does not have any facilities to do this.

Good luck.

6893.

Solve : Help with Batch file and Output?

Answer»

I am trying to write a batch file that will read 100's if IP's from a txt file, ping each one, then output the results to a file. Each successive ping request/results should be appended to the same txt file.

Help!!! please!!

BTW -using winxp pro.if exist pings.txt del pings.txt
for /f %%I in (ips.txt) do ping %%I >> pings.txt


If you are pinging 100's of IP they expect a huge file. Your output for each ping will be similar to this.

Pinging yahoo.com [206.190.60.37] with 32 bytes of data:

REPLY from 206.190.60.37: bytes=32 time=60ms TTL=52
Reply from 206.190.60.37: bytes=32 time=64ms TTL=52
Reply from 206.190.60.37: bytes=32 time=60ms TTL=52
Reply from 206.190.60.37: bytes=32 time=63ms TTL=52

Ping statistics for 206.190.60.37:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 60ms, Maximum = 64ms, Average = 61ms

No you can narrow down you file by using -n options with ping ie like ping -n 1 to send one ping to the host -n 2 would send 2 pings and so on.

Also you can use a find to limit the list like find /i "Reply" to find only machines that are replying to your ping request or a find /i "Pinging" so show every pinged address and whether it resolves or not
Thanks for the great replies, but it seems I am still having a problem that Imdomman was having with ping outputs.

It works from a command line but not from the batch call.

I have the file ips.txt with a single, pingable, address and here is what I get.

Ping.bat -- >
if exist pings.txt del pings.txt
for /f %%I in (ips.txt) do ping %%I >> pings.txt

Output-->
C:\pings>if exist pings.txt del pings.txt
C:\pings\pings.txt
C:\pings>for /F %I in (ips.txt) do ping %I 1>>pings.txt
C:\pings>ping 12.12.12.2 1>>pings.txt

From a Command window I can type -->
ping 12.12.12.2 >> pings12.txt

Output in pings12.txt-->
Pinging 12.12.12.2 with 32 bytes of data:
Reply from 12.12.12.2: bytes=32 time=127ms TTL=234
Reply from 12.12.12.2: bytes=32 time=125ms TTL=235
Reply from 12.12.12.2: bytes=32 time=144ms TTL=235
Reply from 12.12.12.2: bytes=32 time=124ms TTL=234

Ping statistics for 12.12.12.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:
Minimum = 124ms, Maximum = 144ms, Average = 130ms

So anyone know what the 1 is or what is causing it??

Also, when I run the complete list of IPs, I get a message in the command window that says the process cannot access the file because it is being used by another process.start your batch file with this line

@echo off
With @ Echo off the output in my ping.txt file is -->

C:\pings\pings.txt

Without @ Echo the output in my ping.txt file is -->

C:\pings>if exist pings.txt del pings.txt
C:\pings\pings.txt
C:\pings>for /F %I in (ips.txt) do ping %I 1>>pings.txt
C:\pings>ping 12.12.12.2 1>>pings.txt

The ever-present 1 again.... FYI.. I figured out the process sharing violation. It is because the batch file was named PING and PING is also a command, so I think I was confusing it. When I changed the filename to PINGBAT.bat it started to work without the sharing violation.

Now I am WAITING on the results of the complete run, and will post when complete.that 1 you saw is normal.
Quote from: erobby on July 24, 2008, 06:34:18 PM

Also you can use a find to limit the list like find /i "Reply" to find only machines that are replying to your ping request or a find /i "Pinging" so show every pinged address and whether it resolves or not

Where would I use this switch in the command/bat file?Quote from: flainstigator on July 25, 2008, 07:07:31 AM
Now I am waiting on the results of the complete run, and will post when complete.

Thanks for all the help!! The basic file runs complete now. Now to tinker and SEE what ELSE I can do to streamline the outputs.Quote from: flainstigator on July 25, 2008, 07:22:26 AM
Quote from: erobby on July 24, 2008, 06:34:18 PM
Also you can use a find to limit the list like find /i "Reply" to find only machines that are replying to your ping request or a find /i "Pinging" so show every pinged address and whether it resolves or not

Where would I use this switch in the command/bat file?

@echo off
if exist pings.txt del pings.txt
for /f %%I in (ips.txt) do (
ping -n 1 %%I | find /i "Reply" >> pings.txt
)
THANKS - You all ROCK.

Saved me tons of time and angst!!!

Quote from: Dias de verano on July 25, 2008, 07:39:25 AM
Quote from: flainstigator on July 25, 2008, 07:22:26 AM
Quote from: erobby on July 24, 2008, 06:34:18 PM
Also you can use a find to limit the list like find /i "Reply" to find only machines that are replying to your ping request or a find /i "Pinging" so show every pinged address and whether it resolves or not

Where would I use this switch in the command/bat file?

@echo off
if exist pings.txt del pings.txt
for /f %%I in (ips.txt) do (
ping -n 1 %%I | find /i "Reply" >> pings.txt
)


for /f %%b in ('ping -n 2 -a %*^| find /i "Pinging"') do echo %%b >> pings.txt

Same thing just one line
6894.

Solve : moving files using batch?

Answer»

how to move files by their CREATED DATE USING BATCH commands?XCOPY

6895.

Solve : Inherit Permissions?

Answer»

Does ANYONE know if you can set/unset the "ALLOW inheritable permissions from parent to propagate to this OBJECT" OPTION on the SECURITY settings for a folder in MS-DOS?

6896.

Solve : No output file?

Answer»

The following command does a DSquery to get a LIST of computer NAMES from AD which are then filtered using the find /V and after the filter the remaining host are pinged and "Reply From" is searched for. If "Reply From" is found then Errorlevel is 0 indicating successful completion of the command. I can run the command but the files aren't being output. Everything else works correctly the second command works properly and outputs the files but the first one does not output files.

I've tried variations of the if statement, but no output.

I know I can use a BATCH file to produce but I've been experimenting with single line commands and wanted to see at which point will the Windows Command shell break

First Command:
for /f %a in ('dsquery computer -o rdn -limit 10000 ^| find /v /i "at0" ^| find /v /i "braboc" ^| find /v /i "branet" ^| find /v /i "vt0" ^| find /v /i "test"') do for /f %b in ('ping -n 1 %a ^| find "Reply From"') do if %errorlevel% GEQ 1 (echo %a &GT;> c:\notup.txt) else echo %a >> c:\good.txt

Second Command:
for /f "tokens=1 delims=\" %a in ('net view ^| find /v /i "at0" ^| find /v /i "braboc" ^| find /v /i "branet"') do for /f %b in ('ping -n 1 %a ^| find /i "Reply"') do if %errorlevel%==1 (echo %a >> c:\notup.txt) else echo %a >> c:\good.txt

6897.

Solve : starting a script via a batch file?

Answer»

hi all,

I've got a php script that I want to start via a batch file and WAIT for it to close before continuing.

I've installed WAMP which allows me to run php script form the command line. ( i had to add the path of the installation folder to my environment path settings )

I have confirmed that my php script works by opening a command PROMPT and running "php C:\path\to\php\script"

Sadly, I'm having trouble starting this script from a batch file. I've tried...

Code: [Select]start /wait "cmd.exe", "php C:\scripts\php\databse.php"

and EVERY variation of the above, all to no joy.

Any one got any ideas??
Why the start with the /wait SWITCH? Does the script REALLY need to run in another window? Can you not simply run php C:\scripts\php\databse.php within your batch file?

I'm guessing php is in your system path based on the lack of a path in the original post. If a program needs the cmd shell to run, it will be opened automatically by the OS.

Good luck. nice.

your right, i didn't need to run it in it's own window.

Cheers mate

6898.

Solve : DOS??

Answer»

;DHi! My NAME is Valerie Boise, I'm 16 years old and I'm working on a project for class. All of this computer stuff is new to me, I seriously thought I knew a lot when I figured out how to change font colors and SIZES using HTML, lol. Well, apparently I didn't know much. Now my teacher is bringing me to a project where I need to make a DOS bootable disk, that's done. Now he wants me to figure out how to make it so when the disk is in place and you turn on the computer, an educational game will pop up. I read this site a couple of times and maybe I'm just blind or don't understand but I can not figure out how to do this. I do not know how many times I will beable to visit the site so if you have an idea on how to do this, my e-mail is [emailprotected] and I check my mail everyday so I probobly will recieve it. Making the subject "Info about DOS" or something like that would be helpful so I do not accidently delete it. Thanks for your time and consideration.

- Valerie Boisen QUOTE

;DHi! My name is Valerie Boise, I'm 16 years old and I'm working on a project for class. All of this computer stuff is new to me, I seriously thought I knew a lot when I figured out how to change font colors and sizes using HTML, lol. Well, apparently I didn't know much. Now my teacher is bringing me to a project where I need to make a DOS bootable disk, that's done. Now he wants me to figure out how to make it so when the disk is in place and you turn on the computer, an educational game will pop up. I read this site a couple of times and maybe I'm just blind or don't understand but I can not figure out how to do this. I do not know how many times I will beable to visit the site so if you have an idea on how to do this, my e-mail is [emailprotected] and I check my mail everyday so I probobly will recieve it. Making the subject "Info about DOS" or something like that would be helpful so I do not accidently delete it. Thanks for your time and consideration.

- Valerie Boisen

Hi my computer says that the system is running ms dos and microsft windows and i dont know what i did can any one please please help me...

thank you
nancy

What are you wanting it to SAY?

What operating system do you think you are running?

Valerie:

You need to create a batch file that will start the program & save it to the boot diskette. Then you need to edit the AUTO.EXE file on the diskette to start the batch file. These links will help you do your home work:

HTTP://www.google.com/search?hl=en&q=%22batch+file+to+start+a+program%22&btnG=Google+Search

Regards,
Doc
6899.

Solve : One line executes - then stops?

Answer»

I have a bat file, when I run...only the first line gets executed and then the bat stops. Something that seems so easy, I'm pulling my hair out and found this web site. Advice appreciated. Christinaand what is on this line?..\makeit 21-00-00-00-a-001-a-a.xml ..\xsl\dmodule.xsl temp.html -v
..\makeit 21-00-00-00-a-014-a-a.xml ..\xsl\dmodule.xsl temp.html -v


it executes another bat file...makeit.bat...with the next 4 PARAMETERS passed

THANK you....Control will be returned to the original .bat file when the second one finishes and closes. If you preface your command with "CALL" so it would be "call whatever.bat........"
Then the second bat file is told to run but the first continues on.

I'm in heaven !!!! can I give you a

thank you so much !!!!

have a great day, WHEREVER you are....Well now....

Glad I made your day.....

6900.

Solve : Using DOS Today...?

Answer» QUOTE from: BC_Programmer on July 29, 2008, 11:18:43 AM
And I hate to drag this thread on any longer, but this confused me, "so While DOS was not a disk Operating System it was still called DOS because it FUNCTIONED the same Way". I'm not particularly sure what you mean there- all DOS needs to do to live up to the acronym is work with floppy disks (or hard disks, as the case may be). I don't see how the presence or lack of a setup.exe file can disqualify it from the term....

BC_programmer, let the guy have the last word, even if he's wrong. It seems that his personality needs it. Quote from: Dias de verano on July 29, 2008, 11:29:33 AM
Quote from: BC_Programmer on July 29, 2008, 11:18:43 AM
And I hate to drag this thread on any longer, but this confused me, "so While DOS was not a disk Operating System it was still called DOS because it functioned the same Way". I'm not particularly sure what you mean there- all DOS needs to do to live up to the acronym is work with floppy disks (or hard disks, as the case may be). I don't see how the presence or lack of a setup.exe file can disqualify it from the term....

BC_programmer, let the guy have the last word, even if he's wrong. It seems that his personality needs it.

OK. whatever he says next will go unrefuted. You left this thread not because you couldn't argue with the logic presented, but because there wasn't any logic presented, I wish I noticed that as early as you did .... I have met that type of person plenty of times on forums. They cannot BEAR to be contradicted, to such an extent that they will reply with nonsense in order to "win" (as they see it) the argument. My father is one of the people. I know the type well. When you fall silent in stunned amazement at how crazy they are being, they see this as a sign that they have defeated you.

It's like the ones that post a problem with the computer and claim that the power supply must be at fault, regardless of how many times they are told that being unable to right-click .DOC files is not a power-related problem. Then when they replace the power supply and the problem continues, they ask what's wrong with the power supply, without even thinking that maybe the power supply wasn't the problem to begin with.Computers are a bit like cars, in a certain way. That is, there is a certain kind of person, usually male, who reckons he "knows about" them. Often this knowledge does not extend very far at all, and their desperate need to appear all-knowing prevents them from actually ever learning anything from other people.All I was saying is that if you make a statement that DOS does not exist in win2k and later then you have to accept the fact that DOS isn't DOS, because by your standard Microsoft still call it's command.com a DOS interperter.

You can't have it both ways and say there is no DOS in Win2K and later OS's although Microsoft clearly say's it is. In the event you were unaware of this just type command and press enter.

And if this is the last word thank you for you time DIAS and BC. I can assure you I have nothing left to add to this pointless discussion about what is and what isn't DOS. But I do APOLOGIZE Sincerely that my points were either misunderstood or not understood, and yes there is a difference.

C:\>command
Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

C:\>cmd
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>