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.

3901.

Solve : Before????

Answer»

This post is not really about MS-DOS, but DOS in general. I am writing a paper for school and I was looking for information on computers before DOS. :-? I know hey are ancient, but if anyone has ANY information they can GIVE me, I would be very grateful.

You can either respond to this or you can reach me at [emailprotected] or [emailprotected]

Again,
Thank you for anyone who is willing to helpBack when my parents were young (15 years ago), they said that they would feed commands on a paper into a machine about the size of the ROOM. Also, you can google search Charles Babbage, the creator of the first computer system. You will get a lot about him and the first programmer, it was a girl was the only thing I can remember right now. Also, this question does pertain to DOS.Thanks, I'll do just that. Keep in touch if you have anymore info. ThanksCongratulations. You're the first person who needed homework help and was honest about it. Most people try to "trick" us into doing homework for them. While I've never heard of or touched anything before DOS (I was pretty smart for my AGE to use the extreme basics of DOS at three, but I came into the world too late to learn about pre-DOS machines - birthdate is 1991), I applaud your honesty. What a refreshing difference! [smiley=thumbsup.gif]Before DOS, there was the killer OS - CP/M
or if you were lucky enough, bigger machines ran Unix. Other 'mini' OS were multics (unix is a pun on this), PICK which is still alive and well.

Then there were the mainframes (ICL, IBM, Data General etc).

The home computer revolution started with the Altair, the commodore Pet. Sinclair came out with the Mk 14, another popular homebrew computer was the UK101.

There are plenty of websites where you can find out more about these - and other computers.

In 1973, my school had a teletype link to a university mainframe computer where I learned Basic. In 1976-7, my friends brother bought a Pet for an enormous sum (the equivalent cost to a 2nd hand car I remember). He had to persuade the bank manager to lend him the money.

I got a Sinclair ZX80 in 1982 and have never looked back. Funnily my first professional programming work was on an ICL mainframe - for about 7 years.

Good luck with your paper !
GrahamAnyone ever used Tape Operating System from IBM circa 1964 or thereabouts :-?Thanks a lot. I also was trying to find differences in computers before and after DOS but so far I've only found the common info that almost everyone has. If anyone can send me info on that, I would be eternally grateful. Also, what exactly is pre-DOS, I cannot find a single thing on it?The prefix "pre" means before. I was SAYING I knew nothing about machines before DOS. I believe that before Any real civilized operating system... they used Punch cards to run commands...

I did a paper for the evolution of computers... but it's been a while


i know they used to use either Vacuum tubes ... or some other type to store the info... originally trying to get them to store more than on/off (1/0) but after a while the voltage ran down and if it were originally a 10... it could come up as a 9.

I believe Dos was actually created by programmers at Xerox.. but when confronted about it ... Xerox told their programmers, "We make Copiers" what the heck is this going to do for us." and they sold it to Microsoft.

i remember that the first IBM computer took up 1000 square feet. and that it only had 128 KB of space. Thats all I can remember of the top of my head.. maybe do a search for Evolution of Computers i'm pretty sure thats what I did and found amazing amounts of info.

3902.

Solve : Batch file menu?

Answer»

How can I use the ESC key in a menu using the CHOICE COMMAND?
Example:
CHOICE /C:123456(ESC key GOES here) /N
Thanks
CleaverWhat do you want to do with that Escape key. Provided your EDITOR will accept ASCII codes, use alt-027 (must use numeric keypad for the numbers, not the top row of most keyboards). When CHOICE runs the escape CHARACTER will appear as a left pointing arrow.

Note: on laptops where there is no numeric keypad, use alt-fn-027 and use the numbers on the m-j-k-l-u-i-o-7-8-9 keys.

Hope this helps.

3903.

Solve : Colors - one line in blue another in red??

Answer»

Are there any known methods that allow to show
one line of text in blue and
another one in red
from within a DOS batch?

E.g. A debug script created on the fly that does the job?

Or do I have to write my own debug script, poking into video memory?

Thanks in advance for any source you can provide!
That's gonna be great! @echo off
color 40
echo line red
color 80 (i think, not sure, test it)
echo line blue
pause
blackbarry!

If this question wouldn't be a real challenge, believe me, then I wouldn't have it posted here.
The color command changes the color for the whole screen not only for the next output.

I guess I will need to figure this out myself

Just wondering why nobody has ask this question before. There was just somebody asking for mutex via DOS but nobody ask for color ... strange...Quote

blackbarry!

If this question wouldn't be a real challenge, believe me, then I wouldn't have it posted here.
The color command changes the color for the whole screen not only for the next output.

I guess I will need to figure this out myself

Just wondering why nobody has ask this question before. There was just somebody asking for mutex via DOS but nobody ask for color ... strange...

sorry man, I just tried to help


btw its blackb>E<rry, not blackarry


at least you can work with colors on the forum (as seen you sentence) It is an amused question , here you has a possible SOLUTION:

Code: [Select]debug < %0.bat
GOTO fin

N ECHOBLUE.COM
A 100
MOV BL,1
MOV BH,0
MOV SI,0082
MOV AL,[SI]
MOV CX,1
MOV AH,09
INT 10
MOV AH,3
INT 10
INC DL
MOV AH,2
INT 10
INC SI
MOV AL,[SI]
CMP AL,0D
JNZ 109
RET

r cx
22
w


N ECHORED.COM
A 100
MOV BL,4
MOV BH,0
MOV SI,0082
MOV AL,[SI]
MOV CX,1
MOV AH,09
INT 10
MOV AH,3
INT 10
INC DL
MOV AH,2
INT 10
INC SI
MOV AL,[SI]
CMP AL,0D
JNZ 109
RET

r cx
22
w
q

:finCopy an execute the previous BAT, this code make two commands, ECHORED.COM and ECHOBLUE.COM:


ECHORED ¡Hola mundo!
ECHOBLUE Hello world!

¡Hola mundo!
Hello world!

It's obvious that the code could be improved doing that the first argument be the number of color:

ECHOCOLOR 4 ¡Hola mundo!
ECHOCOLOR 1 Hello world!

But now I'm very busy in my work, It's an exercise for you
I wait for your contribution




Here you have a brief explanation of the code:


The first line in the assembler code is the color:

MOV BL,1 : blue
MOV BL,4 : red

You can see the possible values for color with the MS-DOS command:
COLOR /?

You can read the BIOS Interrupts here:

http://www.uv.tietgen.dk/staff/mlha/PC/Prog/asm/int/INT10.htm

-------------------------------------------
INT 10, 9: write 'char'&attrib
AH = 9
AL = char
BH = display page (0)
BL = attribute
CX = no. of repetitions
= 2000(7D0h) to fill 80*25 screen

cursor not moved

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

INT 10, 3: report cursor location, shape
AH = 3
BH = display page (normal = 0) CH, CL = starting, ending scan line
DH, DL = row, column
--------------------------------------------

INT 10, 2: set cursor location
AH = 2
BH = display page (normal=0)
DH,DL = row,col (0..24,0..39/79)
-------------------------------------------

GOOD LOOK !!Doesn't work for me. I get this error:

The system cannot find the file specified.
Thiss is right after the "debug" line. :-?Dilbert,
Try with quotes:
debug < "%0.bat"CARLOS!

This is awesome!

It works well in WinXP when the command window is 80x25. I will continue looking for a solution that works with bigger windows outside the 80x25 range. However this is a good start!
Using the concept of DOS functions described here http://www.cmdtips.com/dostips/DtTutoFunctions.php I came up with the following code that can easily be copied and distributed in a batch file. The helper file ECHOxx.COM will be created on the fly if not already there, whereas xx is the color.

Conditions for the correct EXECUTION are:
  • %temp% variable must point to a valid directory
  • command window must not exceed 80x25
Both conditions are enforced in the example and may be removed if not needed.
A dot appended to the color code will enforce a line break. Without the dot one can output different colors in one line.

Code: [Select]@echo off
rem enforce conditions
if not exist "%temp%" set temp=%tmp%
if not exist "%temp%" set temp=c:\temp
if not exist "%temp%" md "%temp%"
mode con: cols=80 lines=25

call:echo 9. one line of text in blue and
call:echo C. another one in red
call:echo 9 D
call:echo A O
call:echo B S
call:echo C T
call:echo D I
call:echo E P
call:echo F. S
pause

::---------------------------------------
:: FUNCTIONS START BELOW HERE
::---------------------------------------
goto:eof&:: keep this line in order to avoid running into the function

:echo col txt -- colors the previous line red
:: -- col : in - color call color /? for color codes
:: -- txt : in - text output
SETLOCAL
for /f "tokens=1,*" %%a in ("%*") do (
set col=%%a
set txt=%%b
)
set cr=N
if "%col:~-1%"=="." (
set cr=Y
set col=%col:~0,-1%
)
set com=%temp%.\color%col%.com
if not exist "%com%" (
echo.N %COM%
echo.A 100
echo.MOV BL,%col%
echo.MOV BH,0
echo.MOV SI,0082
echo.MOV AL,[SI]
echo.MOV CX,1
echo.MOV AH,09
echo.INT 10
echo.MOV AH,3
echo.INT 10
echo.INC DL
echo.MOV AH,2
echo.INT 10
echo.INC SI
echo.MOV AL,[SI]
echo.CMP AL,0D
echo.JNZ 109
echo.RET
echo.
echo.r cx
echo.22
echo.w
echo.q
)|debug>NUL
"%com%" %txt%
del "%com%" /q
if "%cr%"=="Y" echo.
goto:eof

To be continued ...Quote
Dilbert,
Try with quotes:
debug < "%0.bat"

C:\>debug 0<"echoX.bat"
The system cannot find the file specified.
C:\>goto fin
C:\>

The above is the total output, now, of the batch file.I mean try replacing it in the batch file.I did.DILBERT:

Do you have the debug program ?

If yes, you can assemble the code directly:

C:\colors>debug echored.com
No se encuentra el archivo (translate: File not found)
-a
1559:0100 MOV BL,1
1559:0102 MOV BH,0
1559:0104 MOV SI,0082
1559:0107 MOV AL,[SI]
1559:0109 MOV CX,1
1559:010C MOV AH,09
1559:010E INT 10
1559:0110 MOV AH,3
1559:0112 INT 10
1559:0114 INC DL
1559:0116 MOV AH,2
1559:0118 INT 10
1559:011A INC SI
1559:011B MOV AL,[SI]
1559:011D CMP AL,0D
1559:011F JNZ 109
1559:0121 RET
1559:0122
-R CX
CX 0000
:22
-w
Escribiendo 00022 bytes (translate: writing 22 bytes)
-q
C:\colors>echored hola
hola

P.S. If you don't want to write all the code in assembler, copy it from the Reply #4 (i.e. without address memory) and paste it in the debug.


Good work DosItHelp, a very pretty demostration of colors The .bat file works now, no clue why it didn't before. But now on a black background, I can barely see blue and red... I'm so picky...
3904.

Solve : star out text with set?

Answer»

Hello,

I am using a command similar to

set /p password=ENTER PASSWORD:

in my batch files, to set a variable to a password that is later used. However, when I TYPE this password in, it is shown in plain text. Is there make it hidden by stars?

THANKS, splitGood QUESTION!!

Let me think ... I don't think this can be done by batch files.

A BASIC or C program can do this.
Can this come to your rescue.

3905.

Solve : Download MS-DOs?

Answer»

Does nybody know where i can download MS-DOS :-/If it were possible, I'd be BACKING up my prompt so I don't have to use that PATHETIC EXCUSE for a prompt Windows Vista will be "EQUIPPED" with. Quote

Does nybody know where i can download MS-DOS :-/

It cannot be downloaded legally. Try eBay for a used copy. You can download FreeDos:

http://www.freedos.org/Yeah, but I'd have to give up Windows... :-/
3906.

Solve : DOS fault...?

Answer»

how do i fix a DOS fault that comes up when i try to install Windows 98? i will post the scecifics of the problem when i get out of school, thanks.
Thanks. Details of the problem are always helpful.

heres what it says:

standard mode: fault in ms-dos extender.
ec=00c4 cs=0053 ip=290e ax=00c4 bx=0440 cx=22f0 dx=00fa si=036c di=0001 bp=4278 ds=036c ss=004b sp=4260

standard mode: bad fault in ms-dos extender.
fault: 000d stack dump: 02dc 0000 0070
raw fault frame: ec=00c4 ip=244b cs=0053 fl=3013 sp=00f2 ss=004b

What KIND of DRIVE, size, proposed file system, and how is it partitioned? Has it EVER worked correctly? Are you using drive overlay software of some kind? Can you boot from a floppy?Almighty Google strikes again...

Here is a bit of info from MS, lots more on the WWW

Good luckQuote

What kind of drive, size, proposed file system, and how is it partitioned? Has it ever worked correctly? Are you using drive overlay software of some kind? Can you boot from a floppy?


its a internal HDD 1.99gigs(i know its tiny, but im gonna upgrade... eventualy) yes i can boot from a floppy and CD rom, it worked fine until it CRASHED. and the HDD has 6136 cylinders 16 heads 63 sectors its capacity is 3020MB, the pc registers it as WDC (western DIGITAL caviare) AC33100H. and i dont know what drive overlay software is .Dusty update you missed:


http://support.microsoft.com/kb/q87239/
3907.

Solve : Organising a date sorted Directory tree.?

Answer»

How WOULD I make my batch file create a new subdirectory automatically prefixed by the date stamp?

because I want to create a batch file that will facilitate "digital" file trial of events.The FOLLOWING creates a directory like: 060421

set datepart=%date:~-2%%date:~4,2%%date:~7,2%
if not EXIST "%datepart%" md "%datepart%"


DOS IT HELP?

3908.

Solve : An Important Math Problem?

Answer»

How WOULD I create an "IF" syntax that if I had a number and DIVIDED it by another number my batch file would do [glb]one[/glb] thing if the result:

WAS a WHOLE number NOT equal to 1

and [glb]another[/glb] output if the result:

WAS NOT a WHOLE number NOT equal to 1

for example

5/2= Not Whole
6/2= 3 - Whole
7/7= 1 - Have same return as Not Whole

I am writing a batch file to generate prime numbers
Please help me
I will refine the number througr steps in division and eventually ECHO it back if it [glb]IS[/glb] prime

Thanks For Anything You Might Have
Sigma
Batch language can only do integer arithmetic in W2K or XP, but there is no functionality for floating point division. You either need to use one of many programming languages or one of many scripting languages availabe to Windows.

Get back to us if you need further ASSISTANCE. So is there any way to do division at [glb]ALL[/glb]?

for ex.)

if 25 divided by 5 == 5 (goto start)

Thanks for any help
SigmaYou can do some math with set /a

set /a 25/5

But it isn´t working if it is not an integer.

uliIT WORKED
I finally got mt batch file to echo [glb]ONLY PRIME NUMBERS[/glb]

Dont believe me?
Check the math...

25507
25511
25513
25517
25519
25523
25531
25537
25541
25547
25549
25553
25559
25561
25567
25573
25577
25579
25583
25589
25591
25597
25601
25603
25607
25609
25619
25621
25631
25633
25637
25639
25643
25649
25651
25657
25661
25663
25667
25673
25679
25681
25687
25691
25693
25699
25703
25709
25717
25721
25723
25727
25729
25733
25741
25747
25751
25757
25759
25763
25769
25771
25777
25783
25787
25789
25793
25799
25801
25807
25811
25813
25817
25819
25829
25831
25841
25843
25847
25849
25853
25859
25861
25867
25871
25873
25877
25883
25889
25891
25897
25901
25903
25909
25913
25919
25927
25931
25933
25937
25939
25943
25951
25957
25961
25967
25969
25973
25979
25981
25987
25993
25997
25999

Thanks for all the help
Sigma



I hate to burst your bubble, but the very first three prime numbers on your list are not prime. A noble try, but using the integer math available in batch language cannot solve this. There is no way to isolate the remainders.

A simple script, NEVER to be confused with a C program that can handle huge numbers, might go something like this:

Code: [Select]
For i = 1 to 1000000
primeflag = "y"
For j = 2 to i / 2
If i mod j = 0 Then
primeflag = "n"
Exit For
End If
Next
If primeflag = "y" Then WScript.Echo i & " is prime"
WScript.Sleep 100
Next


The code is only valid to 1 million and basically uses simple arithmetic, but it might give you some ideas. You can get a list of the first 10,000 primes from:

http://www.math.utah.edu/~alfeld/math/p10000.html

Well... perhaps my number sorter wasn't comprehensive enough... This was the process I used:

If CMD divides a number and it isn't whole it rounds DOWN 1. By comparing the output to what it should have been, I refined a number by dividing that number by and only by... [glb]2,3,5 and 7[/glb]
I thought that if a number WASN'T divisible by 2,3,5 or 7 that it was prime. Is this correct? Any suggestions?
Thanks for any help
Sigma

ps.) what would you do w/ that C program to run it?Prime numbers are those which have only themselves and one as divisors. The code above is a VB Script not a C program. To use it, CUT and paste the code into your editor (notepad will work fine), save it with vbs extension. Run in a cmd box:

cscript scriptname.vbs

The Sleep command will slow down processing, but will allow you to see the prime numbers as they go by. The script also gets progressively slower over time since many more divisions are necessary.

Note: I wrote this script down and dirty; if you find a bug, LET me know.

3909.

Solve : help please??

Answer»

!is there a way to open my cd drive using command prompt?By opening do you mean reading the contents or ejecting the drive out.ejecting the drive out
There is no built in command. One way is to open up "My Computer", right CLICK the drive in question and choose Eject.

You can also write a script to handle this:

Code: [SELECT]
Set WMP = CreateObject("WMPlayer.ocx")
Set colCDROMS = WMP.CDROMCollection

If colCDROMS.Count > -1 Then
For i = 0 to colCDROMS.Count - 1
colCDROMS.Item(i).Eject
Next
End If


Save the script with a VBS extension and run from the command line as:

cscript scriptname.vbs

And yes, it works with remote drives provided the drive is mapped as a network share.

Good LUCK.

3910.

Solve : DOS Terminal program?

Answer»

I am trying to write a DOS script file based program that will allow me to SEND and RECEIVE data from a SERIAL Comms port.

I have MANAGED to get the port set up using the MODE command and can send text out through the port.

But I would LIKE to get it to the point where I can Send and Receive data, much like a terminal program.

I am running XP, if that makes any difference.

Thanks to any one who can help
My apologies. I left my question wide open.
At present I am stuck at, how to read the Serial/Com port information, and then display it on screen.

Thanks again
Quote

I am trying to write a DOS script file based program that will allow me to send and receive data from a Serial Comms port.

I have managed to get the port set up using the MODE command and can send text out through the port.

But I would like to get it to the point where I can Send and Receive data, much like a terminal program.

I am running XP, if that makes any difference.



Tou are aware that DOS and command prompt are different? and you are aware that XP and DOS access the hardware differently?
3911.

Solve : Loading windows from DOS?

Answer»

I want to load XP from the D: drive after creating partitions. The windows disk from the bundled package will not allow this apparently unless I usw DOS commands. Can anyone help with this?Please give just a little more info.

When you say you want to install XP from the D: drive what do you mean?? Is D: not your SECOND partition?? and if it is your second partition is there anything on D:??

Have you partitioned, then formatted all partitions??

If you try to install XP from D: exactly what messages are DISPLAYED??

What do you believe that D: drive is.

ThanksI mean that I want to install XP from the CD that cam with my PC. It is a recovery CD. It automaticaly formats and then removes the partitions that I create. I use the software that came with my replacement hard disk to creat the partitions.
So I used the term D drive to refer to the CD drive.Quote

I want to load XP from the D: drive after creating partitions.


Please forgive me, it's hot here & I've had a hard day so my brain is not functioning properly.

The scenario seems to be that you have partitioned your hard-disk and presumably formatted your partitions. You want to "load XP from the D: drive" which is now the second partition on your drive, not your cdrom.

Can you not just use fdisk (or some other software) to create partitions, format, change bios to make your cdrom the first boot option, put the cd in the drive and reboot?

Maybe you could post the messages you get which indicate that you need Dos commands to intall XP.

Sorry about my confusion.


Quote
I mean that I want to install XP from the CD that cam with my PC. It is a recovery CD. It automaticaly formats and then removes the partitions that I create. I use the software that came with my replacement hard disk to creat the partitions.
So I used the term D drive to refer to the CD drive.


You "D-drive" (CD-ROM) must be configured as the 1st boot device in the CMOS setup (BIOS). If not 1st, then before the hard drive.
The drive that I want to load XP from is a cd rom. The partitions on the hard drive will end up being C and D. The OS is on a "recovery disk" that was bundled with the PC from the manufacturer.
The hard drive is a replacement drive and the manufacturer provided partitioning software.
When using the "recovery disk", and following the prompts, it will remove the partitions. The prompts ask if I want to format, and the other is, do I want to run a recovery. This is all in a DOS format. If I select N at each of these prompts, all processes end (stop) and I am then either required to enter a DOS command or start over.That is a problem with some "Recovery Disks" - they just delete ALL the partitions, reinstall how they want, not what you want. I don't know any way around that, if you want to use their software to restore.

It depends on the manufacturer and the product LINES. My last Dell came with a CD of the O/S, but that was several years ago.Did this hard drive come with an image file on it........make model of pc in question may help......The computor is a Northgate with a 1.8 AMD Athlon. I do not know of a specific model number. I would really hate to buy a OEM XP disc just to do a simple task that I want to do.
GX1_Man understands what the situation is. I assumed that there was a DOS command to make the disc do what I want.
With my current set-up I have, two 160G hard drives, and two DVD drives. I want to partition both HD's and maximise the use. I have found that XP will not support a 160G HD, it automatically reduces the size usable to 140G.
If anyone has an idea that does not include purchasing an OEM XP disc please let me know.I don't think it can be done, short of buying a new XP CD. Those restore CD's have a mind of their own.Sa... let me se if i undestend...

The whole ideea is the partitioning of your HDD's... and your WIN XP CD does the partitionig for you ... the way he wants...

Usualy when I install Win XP i make only one partition ... Ex:5 Gb ... and after Win XP is up, I use Partition MAGIC 8 the create, modify, delete, resize the partitions...
3912.

Solve : PLEASE HELP WITH THE "AT" COMMAND?

Answer»

If the file does not exist you will probably get a message "bad command or file name". This whole thread is getting out of hand. Why not just use the interactive task scheduler, fill in the parameters and be done with it?

what does interactive mean?Try this:

Interactive

Oh I forgot.
Starting a batch from a batch doesn´t work with at.
If anyone knows how to fix this, would be great.

uliHello,

We have used AT command to schedule the tasks.

It worked fine.

U can try the following command.

AT 14:30:00 /EVERY:m,t,w,th,f,s,su C:\servicesstart.bat

Thanks
pooja_Dev i know what interactive means, i meant on dos, what does it do if you type it inSteve, lets do this another way. Show US some examples of what you have tried, document any error messages, and let us know the results (or lack of any) that you have gotten.

Get back to us. ive tried
at 12:00PM /every:su,m,t,w,th,f,s start steve.bat
at 12:00PM start steve.bat

each say errorIt would have been helpful had you mentioned the error in full, but that aside, it's apparent you have not chosen to use any of the suggested solutions.

At the risk of REPEATING myself and others who have joined this thread, batch files need to RUN in the cmd environment.

at 5:00PM /interactive /every:Su,M,T,W,Th,F,S cmd /c "path\steve.bat"

should have worked. The /interactive switch is optional but you need to provide a path to your batch file.

I still fail to see your reluctance to document the error message in full (everytime I mistype the AT command I get the help function) or why you cannot use the task scheduler in the Accessories-->System Tools FOLDER on the START menu.


well i dont know the error, after the time i put to activate, i hit at, and it just says error next to it, i dont know what that means...and now you finally tell me how to use the interactice command, i didnt know where to put it, and i dont understand the path\steve....what does path mean?

i want to learn how to use dos, and i know about the scheduler, but i tried it with a .bat, and it didnt work...so idkApparently you and I are having a difficult time communicating. I would would suggest you repost this question and hope someone else can help you out. You need to learn more DOS than is possible in a forum.

Best of luck Steve.

PS. This also applies to your question concerning START.

3913.

Solve : PREFIX TO REVERSE ORDER?

Answer»

Running DOS 6.22 , after the HIMEM test is COMPLETE i get the FOLLOWING message
- Prefix To REVERSE Order
What does this mean &AMP; how can i get rid of it ?Difficult to know what is throwing up the message without viewing your Config.sys and Autoexec.bat files.

Please POST them soonest....

3914.

Solve : Batch on line?

Answer»

How can you put an batch file online? i think that this is impossible, but i WOUD like it if it worked...
Batch goes by CMD.EXE, no server has that on it, so your .BAT file won't work online

Is there an way to put batch FILES online???Quote

How can you put an batch file online? i think that this is impossible, but i woud like it if it worked...
Batch goes by CMD.EXE, no server has that on it, so your .BAT file won't work online

Is there an way to put batch files online???

I don't think you ask the RIGHT question. Do you mean if you want to put batch files online, or if you want to make that you can exucute online, that last one is impossible I think because batch is not a internet-language
3915.

Solve : Network Copy?

Answer»

i've got this line:

copy 1.txt \\server\dir1\ /y

Under admin acount witch has access to dir1 EVERYTHING works fine.

But how do i copy this FILE under common-user account?
Is it possible to set admins username and password in copy proccess?



Ask the admin?Hi.

It's me. I'm admin-user:-)
And i KNOW LOGIN and pass.
I don't know how to get a file copyed under common-user account, so that remote host accepted my request as admins.

--
Hellow.

3916.

Solve : batch file folder create?

Answer»

I am downloading alarm logs from different computers and i need to create a folder (with SUB FOLDERS) incorporating the date and some predefined text into it. I am sure it is quite easy but i have no clue.

here is an example of what i need to do.

working from the WT01_MCC (that is the name of the computer station)

todays date is April 20 2006

I need to create a folder called: [WT01_MCC_Log_Dump_060420] and then move some files into it.

I have created a batch file to make a folder and move files to it. I just cant get the date part. here is what I have so far. (actually this is a small piece of it but I think its enough)

:WT01_MCC_COPY_ROUTINE
md f:\WT01_MCC_Log_Dump\ACTLOG
md f:\WT01_MCC_Log_Dump\ALMLOG
md f:\WT01_MCC_Log_Dump\CP
copy C:\NMS6000\UI\ACTLOG\*.dbf f:\WT01_MCC_Log_Dump\actlog
copy C:\NMS6000\UI\ALMLOG\*.dbf f:\WT01_MCC_Log_Dump\almlog
copy C:\NMS6000\CP\*.log f:\WT01_MCC_Log_Dump\cp
GOTO END

any HELP WOULD be GREATLY appreciatedRick!
This gives you the date part, i.e. 060421:

set datepart=%date:~-2%%date:~4,2%%date:~7,2%
echo.%datepart%


DOS IT HELP? Thank You very much!

3917.

Solve : CMD command question?

Answer»

im totally NEW to DOS, so i just have a simple question:
DOS starts as c:\documents and settings\user

what command do i use to make c:\ THENY displayed path? im trying to access something in c:\windows and dont know how to get thereplease email me the answer because i dont even know how to get to this FORUM to read a reply (i clicked on a link)The reply will be here, right under your question you posted.

If you could find your way back for a second post you can do it.Are we talking about CMD or DOS? They are not one and the same.

Right click the shortcut you use to open the window and select properties. When the properties tab opens, fill in the Start in box to what you want. Click Appy then OK and you're done.

This applies to customizing your CMD experience. Navigating around the directories is a whole other subject best learned from a good book or teacher, but difficult in a forum.

*SIGH*

3918.

Solve : search text file for certain strings on batch?

Answer»

How the *censored* do I use a .bat to SEARCH a text file for certain STRINGS (includes wildcards), and save the found ones to a .txt file? I used to know all this stuff before I learned VB - now I've forgotten everything
I am working on a new PROGRAM for proxies, and I need a .bat file that will find all the strings with, for example, "*:553", and save them - Any IDEAS?Code: [Select]FIND "string" C:\test.txt
The above code will search for all instances of "string" in C:\test.txt and display them. The quote marks are essential, but replace "string" with whatever floats your boat, and C:\test.txt with the actual file. 8-)

3919.

Solve : System File help???

Answer»

What is the system file that allows commands to be exexcuted...error mess.. is COMING up ??

Is their a file that allows Dos to COMMUNICATE with the CPU in my computer? :-/ :-/ In MSDOS, Win9x, and ME the command.com is the SHELL program. In WinNT machines it's cmd.exe that is the shell program.

What error message are you getting and what OS are you running?

3920.

Solve : Trouble Opening Registry?

Answer»

New here, searched and didn't find anything related to my problem...have no idea is this is in the right forum category but oh well.

Anyways, I have Windows Me, and im getting an error when I ATTEMPT to open up the registry...this error occurs in regular mode as well as Safe Mode. Here is what it says:

"This program has performed an illegal operation and will be terminated. Quit all programs, and then restart your computer.

If the program consistently encounters problems, click the start button, then select Help, Troubleshooting, and 'If you have TROUBLE running MS-DOS programs'" (I TRIED both suggestions there)

"The program tried to execute an invalid instructon.

Fault location: 0C16:420D

Interupts in service: None"


My registry has been working fine up until a 2nd repair for my computer. After getting it back from these Microsoft-licensed technician guys, I couldn't open the registry.

I WOULD appreciate any feedback and help. Thanks a ton.

3921.

Solve : stuck in ms-dos...?

Answer»

i was having problems with my COMPUTER so i tried to restart it in safe mode to FIX the problem, theres and option on the shut down menu to restart it in ms-dos mode, i thought that was safe mode so i restarted it in that mode. now that i did that i cannot GET it to restart back to the normal mode. is there a code i can type into the computer to put it back into normal mode? or am i skrewed?

my computer is a windows 98 plus with a pentium 3
Can you type win, or exit?Push the button.yeah using exit worked, im pretty IGNORANT when it comes to computers, thanks alot for the HELP

3922.

Solve : deleting files from subdirectories?

Answer» HI, I've GOT a problem.
I'm to CREATE a batch file that make such things:

Delete all files in directory(I type the name of it) and all files in subdirectories. WRITING the name and PATH of all current deleting file.

(cant use deltree of course )
I'm not good in this so any help will be welcome
3923.

Solve : To Open Windows in DOS?

Answer»

My boyfriend is trying to FIX his uncle's comp. He knows what he needs to do but first he has to get it to let him into DOS..... It starts up, says there's a prob and then SHUTS down. He just needs to know what he needs to hit to get into DOS. OS is Windows 98........that's all I know..... I know it's not much info.....I'll make him LEAVE more info when he gets off WORK but for now, that's all I've got.

Keep tapping F8, after the POST. Then select "Command Prompt" from the menu.Download a startup disk (free at www.bootdisk.com) and you can only be in DOS.

If you are trying to get into safe mode or command prompt you can tap F8 at bootup.

No matter what the problem is, I doubt this will solve it at all, but let us know.No need for the KEY tapping on the F8. Simply hold down the Ctrl key while it boots.

3924.

Solve : Read from another file?

Answer»

Hy,

I would like to make an batch program that reads an peace in an other file, for example this :: there is an .TXT file whit the text "test" in.
I want that the batch program checks that program for what is in it, for this example is this test.

can someone give me an script plz

thx

mikinobody?If I understane you right, you want to find a pattern like text.

You can do
type file.txt | find "text"that script open the file. I want that the program gives the text that is in the file, not open it. sorry for the late respond, but I was on vacation...

This will display the text's contents on the screen:

Code: [Select]@ECHO OFF
for /F "tokens=1,2* delims=," %%i in (file.txt) do @echo %%i %%j %%k
Put that in your batch and see what happens. Replace file.txt with the NAME of the text file you're using for testing. Try putting a ton of text in that file and see what happens. 8-)or perhaps ...

The following will preuse every *.txt file and display the filename & the line of each occurance of "test".

findstr /i /c:"test" *.txt

For more info ...
findstr /?
Searches for strings in files.

FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
[/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]]
strings [[drive:][path]filename[ ...]]

/B Matches pattern if at the beginning of a line.
/E Matches pattern if at the END of a line.
/L Uses search strings literally.
/R Uses search strings as regular expressions.
/S Searches for matching files in the current directory and all
subdirectories.
/I Specifies that the search is not to be case-sensitive.
/X Prints lines that match exactly.
/V Prints only lines that do not contain a match.
/N Prints the line number before each line that matches.
/M Prints only the filename if a file contains a match.
/O Prints character offset before each matching line.
/P SKIP files with non-printable characters.
/OFF[LINE] Do not skip files with offline attribute set.
/A:attr Specifies color attribute with two hex digits. See "color /?"
/F:file Reads file list from the specified file(/ stands for console).
/C:string Uses specified string as a literal search string.
/G:file Gets search strings from the specified file(/ stands for console).
/D:dir Search a semicolon DELIMITED list of directories
strings Text to be searched for.
[drive:][path]filename
Specifies a file or files to search.

USE spaces to separate multiple search strings unless the argument is prefixed
with /C. For example, 'FINDSTR "hello there" x.y' searches for "hello" or
"there" in file x.y. 'FINDSTR /C:"hello there" x.y' searches for
"hello there" in file x.y.

Regular expression quick reference:
. Wildcard: any character
* Repeat: zero or more occurances of previous character or class
^ Line position: beginning of line
$ Line position: end of line
[class] Character class: any one character in set
[^class] Inverse class: any one character not in set
[x-y] Range: any characters within the specified range
\x Escape: literal use of metacharacter x
\xyz\> Word position: end of word

For full information on FINDSTR regular expressions refer to the online Command
Reference.Quote

This will display the text's contents on the screen:

Code: [Select]@ECHO OFF
for /F "tokens=1,2* delims=," %%i in (file.txt) do @echo %%i %%j %%k
Put that in your batch and see what happens. Replace file.txt with the name of the text file you're using for testing. Try putting a ton of text in that file and see what happens. 8-)


it works, thanks for help
3925.

Solve : suffix used after type command?

Answer»

I want to be able to read page by page after using the TYPE command in DOS 6.22. What suffix is used after the command as in-- type config.sys ?? is it /p. /p does not work. Please help.
Couple of ways to do this. The type command takes no switches.

type filename.ext | more

OR

more < filename.ext

Hope this helps. Thanks Sidewinder, but when I use either command you listed ( |more or more< ) they both come back as bad command or FILE NAME. I am using dos 6.22 CHECK to see if you have more.com in your DOS directory. If not, you should be able to copy it from your DOS DISK. If it is in a different directory, make sure that directory is in your PATH.

3926.

Solve : List of choices in a batch file?

Answer»

Ok, i'm trying to work out how to make a list of options for different songs on my computer, i'm pretty noob to this but i hope you will still help me.

Example:

1. Song 1

2. Song 2

*User press 2 on keypad*

*Song 2 opens"

I know how to OPEN the songs from a batch file, i just need to know how to make the choices menu for the users input.No problem.

Code: [Select]Set /p var=Choose your preferred song:
IF "%var%"=="1" GOTO 1
IF "%var%"=="2" GOTO 2

:1
[insert code for playing song 1 here]

:2
[insert code for playing song 2 here]
You can change the word "var" to ANYTHING you want, so long as you're consistent. Also note that if you want, and if the code for opening the songs is one line, you can do without the GOTO and just SAY:

Code: [Select]IF "%var%"=="1" [song code]
However, I find this more organized and you can reference it later in a LARGE batch file.

You can also secure your choices with this:

Code: [Select]:choice
Set /p var=Choose your preferred song:
IF "%var%"=="1" GOTO 1
IF "%var%"=="2" GOTO 2

ECHO Please try again. This is not a valid choice.
GOTO choice

:1
[insert code for playing song 1 here]

:2
[insert code for playing song 2 here]
The ECHO bit will only show if the user does not press 1 or 2.

Good luck. 8-)Thanks .

I've also made one for opening programs. I've searched the internet and the part on this site but i can't get a working delay between two commands(that each open a program). How do i set a delay between those two particular commands?

Example:

[Open first program]
*1-1.5 min delay*
[Open second program]Forgive me, im an idiot lol. Considering i've done some C++ programming you'd think i WOULD have considered 'Sleep', and maybe looked a little harder on this particular website? Anyway, thanks for the help Anytime.

3927.

Solve : 'Error in Config.sys line 7'?

Answer»

I get the message 'Error in Config.sys Line 7' everytime i start my PC please is there anyone that can help me out? What STEP do i have to go through to eliminate this problem. ThanksLook at the file and tell us what line 7 SAYS, and what is your OPERATING system.hiya ive done sum research on the net and it LOOKS like my command.com file is either missing or corrupt, but it doesnt tell me the steps or WAYS to eliminate the error message, can u help me please. My operating system is windows XP. Thanks

3928.

Solve : command line for networking?

Answer»

i'm a system admin at my institution, i need all COMMAND network command LINE to maintain, configure, SETTING and TESTING my server and client... can any ONE help me plz???

3929.

Solve : Can't startup!!?

Answer»

I just bought a Compaq Deskpro EN computer from a school auction & have it setup and running. The screen is asking for a command and I have no clue what it wants. It has ms-dos (r) version 6.20. Can anyone tell me what command I need. NOTHING has worked so far.
Thanks for any helpThey erased the whole hard drive including Windows. Just reinstall Windows and you should be fine.Do you have an operating system to load on it?Yes, I do.So what does the OS says? Or do you just get a C:/>I haven't loaded anything as of yet. I do have a windows xp i can load into it. The screen is displaying
C:/>Have you tried typing win and then hitting enter ? ?
If Windows is still on that machine this is how to start it.

If not restart the machine with a Windows CD and the setup process will start.

patio. Win did not work so I will load the CD. ThanksYou're Welcome....and let us know how it goes.

patio. What are the specs on that machine - RaM, hard drive and video? It will be in the setup screen (F10 at boot up)

Is this a legal COPY of XP you got for that machine? If not activated in 30 days it will cease to function.

3930.

Solve : error loading mouse.drv -- must re-install windows?

Answer»

I THINK there is more than a MOUSE PROBLEM here.

3931.

Solve : Scroll in MS-DOS?

Answer»

Is it possible to scroll in MS-DOS? The net view i wish to view is to LONG In the prompt, yes. In MS-DOS mode on 9x MACHINES, no. But you can do it with the prompt, no NEED for MS-DOS mode... Why not try adding "| more" to the end of your command. This will let you see all the output before it continues.

Or maybe you would like to SAVE the output to a text file by typing "net view &GT; C:\netview.txt".thanks

3932.

Solve : Zero Byte Files?

Answer»

Hi,

I have done some DOS batch programming in the past, but I have run into a SITUATION where I could use some help.

How do tell if a FILE has 0 (zero) bytes. I have a script that goes to an FTP site to bring in a file. It creates a file EVEN if there is nothing there, hense a file with zero bytes.

I want to be able to test for this and NOT copy it to a directory that other software is monitoring. The software process it, but generates errors. The users don't LIKE errors.

I can do it in a *nix script, but I am at a loss to do it in DOS.

I seem to remember a batch file comparing an existing zero byte file to the new file and if it matched, then it was emtpy.

I can't find the reference and I can't find anything in my DOS manuals.

HELP.

Thanks to all.edi_guy!

Is this what you want?

set file=filename.txt
for %%a in ("%file%") do set size=%%za
if "%size%" NEQ "0" echo.DO THE COPY


or

set file=filename.txt
dir "%file%"|find /i " 0 %file%">NUL&&echo.DO THE COPY


I would prefer the first one.
Check also http://dostips.cmdtips.com/DtCodeSnippets.php

Hope this helps

3933.

Solve : RD Command Clarafication?

Answer»

I was just wondering if I were to type "RD C:\ /S /Q" then that command would delete my hard drive without asking. Or do I need to put "*.*" after the "C:\"?C:\WINNT\system32>help rd
Removes (deletes) a directory.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S Removes all DIRECTORIES and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S

It SEEMS you don't need the *.* but I'm not sure how it would go with protected files. (And I'm not trying it)

Check out 'deltree'.

Thank you for your quick response, now I can go on with my "study" of DOS.Wait, one more thing. Do I need the "[]" or do I LEAVE those out when inputting the command in DOS?Leave them out.Why would the ceo of apple/mac ask this/?Everyone has to LEARN sometime...

PATIO. What is the purpose of this question? When would that command be relevant over format c: /q/u

3934.

Solve : The most colorful BAT file in the world!?

Answer»

Copy this out into a BAT file.

REM {This section PREPARES the command shell for running this batch file}
TITLE
:BEGINCOLOR
COLOR 00
COLOR 01
COLOR 02
COLOR 03
COLOR 04
COLOR 05
COLOR 06
COLOR 07
COLOR 08
COLOR 09
COLOR 0A
COLOR 0B
COLOR 0C
COLOR 0E
COLOR 0F
COLOR 10
COLOR 11
COLOR 12
COLOR 13
COLOR 14
COLOR 15
COLOR 16
COLOR 17
COLOR 18
COLOR 19
COLOR 1A
COLOR 1B
COLOR 1C
COLOR 1D
COLOR 1E
COLOR 1F
COLOR 20
COLOR 21
COLOR 22
COLOR 23
COLOR 24
COLOR 25
COLOR 26
COLOR 27
COLOR 28
COLOR 29
COLOR 2A
COLOR 2B
COLOR 2C
COLOR 2D
COLOR 2E
COLOR 2F
COLOR 30
COLOR 31
COLOR 32
COLOR 33
COLOR 34
COLOR 35
COLOR 36
COLOR 37
COLOR 38
COLOR 39
COLOR 3A
COLOR 3B
COLOR 3C
COLOR 3D
COLOR 3E
COLOR 3F
COLOR 40
COLOR 41
COLOR 42
COLOR 43
COLOR 44
COLOR 45
COLOR 46
COLOR 47
COLOR 48
COLOR 49
COLOR 4A
COLOR 4B
COLOR 4C
COLOR 4D
COLOR 4E
COLOR 4F
COLOR 50
COLOR 51
COLOR 52
COLOR 53
COLOR 54
COLOR 55
COLOR 56
COLOR 57
COLOR 58
COLOR 59
COLOR 5A
COLOR 5B
COLOR 5C
COLOR 5D
COLOR 5E
COLOR 5F
COLOR 60
COLOR 61
COLOR 62
COLOR 63
COLOR 64
COLOR 65
COLOR 66
COLOR 67
COLOR 68
COLOR 69
COLOR 6A
COLOR 6B
COLOR 6C
COLOR 6D
COLOR 6E
COLOR 6F
COLOR 70
COLOR 71
COLOR 72
COLOR 73
COLOR 74
COLOR 75
COLOR 76
COLOR 77
COLOR 78
COLOR 79
COLOR 7A
COLOR 7B
COLOR 7C
COLOR 7D
COLOR 7E
COLOR 7F
COLOR 80
COLOR 81
COLOR 82
COLOR 83
COLOR 84
COLOR 85
COLOR 86
COLOR 87
COLOR 88
COLOR 89
COLOR 8A
COLOR 8B
COLOR 8C
COLOR 8D
COLOR 8E
COLOR 8F
COLOR 90
COLOR 91
COLOR 92
COLOR 93
COLOR 94
COLOR 95
COLOR 96
COLOR 97
COLOR 98
COLOR 99
COLOR 9A
COLOR 9B
COLOR 9C
COLOR 9D
COLOR 9E
COLOR 9F
COLOR A0
COLOR A1
COLOR A2
COLOR A3
COLOR A4
COLOR A5
COLOR A6
COLOR A7
COLOR A8
COLOR A9
COLOR AA
COLOR AB
COLOR AC
COLOR AE
COLOR AF
COLOR B0
COLOR B1
COLOR B2
COLOR B3
COLOR B4
COLOR B5
COLOR B6
COLOR B7
COLOR B8
COLOR B9
COLOR BA
COLOR BB
COLOR BC
COLOR BD
COLOR BE
COLOR BF
COLOR C1
COLOR C2
COLOR C3
COLOR C4
COLOR C5
COLOR C6
COLOR C7
COLOR C8
COLOR C9
COLOR CA
COLOR CB
COLOR CC
COLOR CD
COLOR CE
COLOR CF
COLOR D0
COLOR D1
COLOR D2
COLOR D3
COLOR D4
COLOR D5
COLOR D6
COLOR D7
COLOR D8
COLOR D9
COLOR DA
COLOR DB
COLOR DC
COLOR DD
COLOR DE
COLOR DF
COLOR E0
COLOR E1
COLOR E2
COLOR E3
COLOR E4
COLOR E5
COLOR E6
COLOR E7
COLOR E8
COLOR E9
COLOR EA
COLOR EB
COLOR EC
COLOR ED
COLOR EE
COLOR EF
COLOR F0
COLOR F1
COLOR F2
COLOR F3
COLOR F4
COLOR F5
COLOR F6
COLOR F7
COLOR F8
COLOR F9
COLOR FA
COLOR FB
COLOR FC
COLOR FD
COLOR FE
COLOR FF
GOTO:BEGINCOLORthats just, scary, my stepdad freaked when i RAN this on fullscreen on his computer :DMy dog had a SEIZURE. I hope he will be alright soon.

It was NICE slide show Adam!!

3935.

Solve : network printing?

Answer»

Does anyone knows how to print USING network PRINTER?
I tried to use "print /d:\\Xenprint1\dell1710 d:\1.txt" where "Xenprint1" is server name and "dell1710" is the printer name while "1.txt" is the fle name located in D drive, it SHOWN "D:\1.txt is currently being printed" but I get nothing.

I also tried to use "cscript prnmngr.vbs -g" , it shown "The default printer is DELL Laser Printer 1710", that's meant the printer name is correct.

I also tried to use "cscript prnqctl.vbs -e -s Xenprint1 -P dell1710" , it shown "Microsoft ... Copyright...", But it did not print?anyone?

3936.

Solve : Backup Batch file help?

Answer»

Ok, here is the code (don't forget to scroll, it's kinda LONG)

Code: [Select]:: backup.bat
@echo off

set $string=%date%

:: Calling the batch file that looks for the day: JSI FAQ #4192

call $contains.bat "%$string%" Mon
IF "%$answer%" EQU "Y" GOTO Monday ELSE GOTO NotMon


:NotMon
call $contains %$string% Tuesday
if "%$answer%" EQU "Y" goto Tue Else goto NoTue
goto NoTue

:NoTue
call $contains %$string% Wednesday
if "%$answer%" EQU "Y" goto Wed ELSE goto NoWed

:NoWed
call $contains %$string% Thursday
if "%$answer%" EQU "Y" goto Thu ELSE goto NoTue

:NoThu
call $contains %$string% Friday
if "%$answer%" EQU "Y" goto Fri ELSE goto Panic

:::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::

:Monday
if exist mon_backup.txt del mon_backup.txt
@echo Running Monday's Backup
goto finished

:Tuesday
if exist tue_backup.txt del tue_backup.txt
@echo Running Tuesday's Backup
goto finished

:Wednesday
if exist wed_backup.txt del wed_backup.txt
@echo Running Wednesday's Backup
goto finished

:Thursday
if exist thu_backup.txt del wed_backup.txt
@echo Running Thursday's Backup
goto finished

:Friday
@echo Running Friday's backup, have a nice weekend!
if exist fri_backup.txt del fri_backup.txt
goto finished

:finished
echo.
@echo Today's backup successful
echo %$answer%
echo %$string%
goto :EOF

:Panic
@echo VALID DATE NOT FOUND
@echo Reported date is %$string%
goto :EOF

REM End Of File
And here is the problem. No matter what, it will skip to :Monday (or lower if i remove those lines) and completely ignore everythng in the middle. the first Everything after the CALL is ignored until it gets to :Monday.

The file that it is calling is located: http://www.jsifaq.com/SUBI/tip4100/rh4192.htm
-----

I am so confused, any help WOULD be appreciated!Since %date% will RETURN only 3 letters for the day you may want to change
call $contains %$string% Tuesday
to
call $contains %$string% Tue
and so on.

Or put your sunglasses on and do it SIMPLE 8-):

Code: [Select]:: backup.bat
@echo off

[highlight]goto:%date:~0,3% 2&GT;NUL
goto:Panic[/highlight]

:::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::

:Mon
if exist mon_backup.txt del mon_backup.txt
@echo Running Monday's Backup
goto finished

:Tue
if exist tue_backup.txt del tue_backup.txt
@echo Running Tuesday's Backup
goto finished

:Wed
if exist wed_backup.txt del wed_backup.txt
@echo Running Wednesday's Backup
goto finished

:Thu
if exist thu_backup.txt del wed_backup.txt
@echo Running Thursday's Backup
goto finished

:Fri
@echo Running Friday's backup, have a nice weekend!
if exist fri_backup.txt del fri_backup.txt
goto finished

:finished
echo.
@echo Today's backup successful
echo %$answer%
echo %$string%
goto :EOF

:Sat
:Sun
:Panic
@echo VALID DATE NOT FOUND
@echo Reported date is %$string%
goto :EOF

REM End Of File
Then you pull out a cigar and do it even simpler:

Code: [Select]:: backup.bat
@echo off

[highlight]set day=%date:~0,3%
goto:%day% 2>NUL
goto:Panic[/highlight]

:::::::::::::::::::::::::::::::::::::::::::::::::::::::

[highlight]:Mon
:Tue
:Wed
:Thu
:Fri
if exist %day%_backup.txt del %day%_backup.txt
echo.Running %day%'s backup[/highlight]
echo.
echo.Today's backup successful
goto :EOF

:Panic
@echo VALID DATE NOT FOUND
@echo Reported date is %day%
goto :EOF

REM End Of File
DOS IT HELP?Hey! that is simpler!!

Thanks for pointing out my mistake, I had written and rewritten it so many times trying to get it to work that I didn't even notice I changed those lines.

Can you explain exactly what is going on in the Code: [Select]goto:%date:~0,3% 2>NUL
Thank you very much for your help!Sure, here is an explanation:

See also the help for the set command here
http://dostips.cmdtips.com/DosCommandRef.htm#set

%date:~0,3%
... resolves the environment variable date and extracts 3 characters starting at position 0. Since %date% returns something like
[highlight]Fri[/highlight] 04/21/2006
this way you get the day only.

goto:%date:~0,3%
... will subsequently use the day (e.g. [highlight]Fri[/highlight]) as a label and attempt to jump to it.
However if the label doesn't exist (e.g. [highlight]Sat[/highlight]) then it would not jump anywhere but show an error. In order to avoid seeing the error on the screen, we pipe the error output into the NUL device and trash it using:
goto:%date:~0,3% 2>NUL

3937.

Solve : nconvert?

Answer»

Hi,

I would like to use a BACH file to convert .bmp file to .jpg file.
I am using NCONVERT v4.57.
Here is my code:
Code: [Select]set today=%DATE:/=%
nconvert -D -out jpeg -o %_%today%.jpg *.bmpWhen I put these 2 lines in a .BAT or .cmd file and just launch the file, it dosn't work.
When I execute directly these 2 lines in a dos console, it works.
It will return:
CONVERSION of today.bmp into today_21042006.jpg OK

FYI:
-o filename : Output filename
Use % to specify SOURCE filename

Thank you.Friend of MINE helped me out:

Code: [Select]set today=%DATE:/=%
nconvert -D -out jpeg -o %%_%today%.jpg *.bmp

3938.

Solve : Re: NEED BATCH FILE CODE HELP!!?

Answer»

Corrections are made in BLUE. Strikethrough = delete


SURVEY.BAT
@echo off
SET RATING==FAILURE (closed space)
ECHO %2, please rate the %1 movie you saw on a scale of 1 to 5.
CHOICE (1=I want my money back, 2=Poor, 3=Okay, 4=Better than I was expecting, 5=I LOVED IT)
set /p var=1-5:
IF errorlevel 3 RATING=SUCCESS
IF "%var"=="1" SET RATING=SUCCESS
IF "%var"=="2" SET RATING=SUCCESS
IF "%var"=="3" SET RATING=SUCCESS
IF "%var"=="4" SET RATING=SUCCESS
IF "%var"=="5" SET RATING=SUCCESS

BATCH1.BAT
@echo off (corrected spelling)
REN BATCH Lab 1
SET RATING=
ECHO Hello, %1.
set /p day=How is your day? Good or Bad(G/B)?
If /I day=B GOTO SORRY
ECHO That's nice.
GOTO NEXT
:SORRY
ECHO Awww. I'm sorry to hear you're having a bad day.
CHOOSE /C:123 What would make you feel better (1=Go to a movie, 2=Go to SLEEP, 3=Play World of Warcraft)
IF errorlevel 1 goto MOVIE
IF errorlevel 2 goto HOME
IF ERRORLEVEL 3 GOTO WoW
:MOVIE


This is how far I've gotten so far. I'm afraid I have to get to bed, but I'm sure Sidewinder or someone else will be here soon enough to finish it. Thank you very MUCH for your amazingly quick reply, you guys rule!Same color key. I only have 15 MINUTES; let's see how fast I can do this.

set x=1-Comedy
set y=2-Adventure
set z=3-SciFi
ECHO The three genres available are
FOR a%% IN (%x% %y% %z%) echo %%A What is this line for? :-?
CHOICE /C:123 /T:10,3 Which of the above movie genres would you like to see
IF errorlevel 1 GOTO SCIFI
IF errorlevel 2 GOTO ADVEN
IF errorlevel 3 GOTO COMEDY
:SCIFI
ECHO Enjoy your %z% movie.
CALL SURVEY
GOTO NEXT
:ADVEN
ECHO Enjoy your %y% movie.
CALL SURVEY
GOTO NEXT
:COMEDY
ECHO Enjoy your %x% movie.
CALL SURVEY
GOTO NEXT
:HOME
ECHO Class dismissed, go home.
ECHO NOT!
GOTO NEXT
:WoW
ECHO Yeah, me too.
:NEXT
IF NOT "%RATING%"="" ECHO The movie was a %%RATING.
ECHO Have a nice day, %1.


How does it work now? Any other problems? And what was that line with the FOR supposed to do, anyhow? :-?

3939.

Solve : Launch a shortcut?

Answer»

I am trying to run a dos file from a CD. I want to have it run FULL screen, but in XP I don't have the OPTION in the properties. If I CREATE a shortcut to the bat file I can change the options but I don't know how to run the shortcut from a bat file.

I tried this but it didn't work

START "C:\path\filename.lnk"

also I tried

CALL "C:\path\filename"

this would launch the shortcut, but it didn't run it at full screen like I have in the properties of the shortcut. Any IDEAS how to get this to run full screen?

ThanksYou MAY need to enable EXTENSIONS

In a batch try:
@SETLOCAL ENABLEEXTENSIONS
@C:\path\filename.lnk


DOS IT HELP?

3940.

Solve : rename a file incremental number in batch file?

Answer»

Hi All -

Can anyone please help me on a task that I been trying to figure out for days. I have an XML file that gets CREATED everytime I execute an Access program and this XML file get overwritten everytime I re-run the Access program. However, I need to archive the XML file some I can do some reportings. So my plan is to write a bacth file to 1st copy the XML file to another folder, 2nd rename it with an incremental number (ex. extract001.xml -- this the part I can't seem to figure out) , and 3rd launch the Access program and re-run it.

This is what I have so far.

XCOPY \\di-upload\di-st_perf\HealthCare-ID\Extraction_Batch.xml \\di-upload\perf_data\xml /s /y /d /i /h /C

REN \\di-upload\perf_data\xml\Extraction_Batch.xml "Extraction_Batch%5#.xml"


Any help or suggestion I greatly appreicated.dhuynh,

Would it be ok to put a date-time-stamp in the fileneme? If yes then referring to
[highlight]http://dostips.cmdtips.com/DtCodeSnippets.php[/highlight] - Making a Unique String
it will be a two liner:

Code: [Select]for /F "tokens=2-8 delims=/:. " %%A in ("%date%:%time: =0%") do @set UNIQUE=%%C%%A%%B%%D%%E%%F%%G
XCOPY \\di-upload\di-st_perf\HealthCare-ID\Extraction_Batch.xml \\di-upload\perf_data\xml\Extraction_Batch_%UNIQUE%.xml
Your filename would be something like:
Extraction_Batch_2006042023521504.xml

Note very convenient:

  • You can order the DESTINATION directory by name and the files will appear in the order created
  • Based on the unique number you can easy see when you created the file, i.e.: YYYYMMDDhhmmssdd.
  • You run this every 0.01 second and still get unique file names.
DOS IT HELP? ;)
3941.

Solve : Copy new files to new directory?

Answer»

Hi
I want to copy just new or modified files (xcopy dest1 dest2 /d) but I want to copy it, to another directory (dest3)
(my OS is win XP)
Someone can help?
Thanks
LT [smiley=beer.gif]LOOK at ROBOCOPY perhaps ... HTTP://www.ss64.com/nt/robocopy.html

Hope it's of some help to you.It,

Just in case you want to do this in PURE DOS look here:
[highlight]http://dostips.cmdtips.com/DtTipsCopy.php[/highlight]

SUMMARIZING you could do this:

for /f %%a in ('xcopy "%dest1%" "%dest2%" [highlight]/L[/highlight] /D /Y') do (
xcopy "%%a" "%dest3%" /Y
)


If you want to copy to dest2 and dest3 then remove the [highlight]/L[/highlight] option.
If you want to copy to dest3 only then keep the [highlight]/L[/highlight] option.

DOS IT HELP?

3942.

Solve : How do I get free disk space using a batch file??

Answer»

I need to install a program and to do this I need to USE an unattended batch file to see if there is enough available disk space and then allow the batch processing to continue if there is enough.

How do I get the free space on a disk and how do I compare it to what is needed?

Thanks
In the ressourcekit is a command called diruse.
This can show you the diskspace in kb or mb...

You can compare this with the needed space with an if ... equ ... statement.

Using the native dir command you have to extract the last line an bring it in a variable with a for statement.

for /f ... ('dir | find "Bytes frei') do ...

Depends how the output looks like.

On my machine it is 1.886.625.280 Bytes frei

So you have to compare it in bytes. I never tried it. So I don't know if there are restricitions how "big" the numbers can be.

hope this helps
uliThe NUMERIC limit for XP seems to be 2147483647. If you add 1 you will get -2147483648.

If you don't care about single bytes for your calculation then cut off the last 3 DIGITS and calculate in KB (where 1kb = 1000 bytes) like this:

Code: [Select]SET drive=C:
FOR /f "tokens=3 delims= " %%a in ('"dir %drive%\|find "bytes free""') do set free=%%a
SET free=%free:,=%& rem eliminate commas in number
SET free=%free:.=%& rem eliminate dots in number
SET free=%free:~0,-3%& rem divide by 1000 by cutting off the last 3 digits
SET MIN=4000& rem minimum 40000000 bytes
IF %free% LSS %min% ECHO.NOT ENOUGH SPACE&GOTO:EOF
ECHO.INSTALL ...
DOS IT HELP ?

3943.

Solve : FCB ERROR?

Answer»

I have a dos program which runs ok in W98
Upgraded to XP and on 2 DIFFERENT SCREENS I get an FCB
unavailable error. The
rest of the data BASE screens work OK

Any Help ?
DOS programs have limited functionality on XP. Quite an "upgrade", huh?What's this FCB. FCB is File Control Blocks. It is a function in DOS that is loaded through config.sys. It might not work at all in XP unless you can make it COMPATABLE. If you want to try, uninstall the program and then reinstall but run the entire installation in compatability mode.

3944.

Solve : Lose Focus/Get Focus?

Answer»

Is is possible to use a LOSE Focus/GetFocus command for the current command window?

IE: When this window loses focus, pause the .bat file. When this window gets focus, resume .bat command.

I was thinking along the lines of running a .bat that pops up a message using the MSG command (which would cause the .bat to lose focus). The user would click the OK button and the .bat would resume focus (assuming the user doesn't click anything ELSE) - or could you name the massage window and have the .bat resume when that OK button is pressed?

By the way (or, BTW for those who are fancy), I love these forums! You all have been so much help!Did you try the msg- command with call?

uliUse the /w switch on the msg command. This will FORCE a wait until the msg is answered.

Hope this helps.

Do not confuse this with focus which is implemented in Windows not batch language.

3945.

Solve : What does the & sign do and How can I use it?

Answer»

I used DOS a long time ago (pre windows), but never used it very much. I read about USING notepad to create a bat file to run programs, and automate processes. I have made a couple of things work, but one thing that I would like to do is get all of my Financial information to come up together. E.g. I have my budget, Quickbooks file, and 2 bank sites I want to come up to the signon screen.

The problem I am having is on one of the bank signon screens, there is an & near the end of the address. I noticed that when I run the script the address is only filled in up to the &. This is probably not news to you, but it makes the page fail to load. Why is this happening and is there anything I can do to get around it.

Also, I was wondering if there is any way to pause until one page is loaded, type in the sign on information, and then continue with the next.

I would greatly appriciate any help I can get.

The ampersand is used in DOS to create COMPOUND commands. As PART of a web address it has no special meaning, but the DOS interpreter see's it as a meaningful symbol. You could try quoting the bank addresses, or you could write a windows script. Note: windows script also sees the ampersand as a compound instruction but within quotes is permissable.

Hope this helps. What is Windows script, and how would I USE it. I want something that I would not have to install on every COMPUTER that I want to use it on. I am really just looking for something that will help automate things.

I will try the quotes later and let you know how it goes. I am in a little bit of a rush right now. Thank you for your help.Windows Script has been installed on all Windows machines since Win95B although Microsoft has done very little to promote it. Think of it as batch language for the Windows Guy (it's actually much, much more). The current version of the Windows Script Host is 5.6

If you have Win2K or XP you probably have everything you need. Other versions of Windows may need to be updated. You can read about it and download any tools you may need from the Script Center


Happy Scripting.

3946.

Solve : COMMAND LINES?

Answer»

The FAT32 or NTFS file system found in VARIOUS versions of Windows stores files with both a short name and a long name. steve number2.exe is the long file name. The short file name is probably SOMETHING LIKE steven~1.exe. (You can verify this by running a DIR /x command against the directory where steve number2.exe exists).

Normally you reference files with their long file name by enclosing them in quotes. Since the START command thinks that quoted literals are the Window title, you have to workaround the problem by using the short file name.

Use the short file name in your START command.

I hope this enough to get you started. Don't be afraid to experiment a BIT.

Good luck.

I have no idea what w/e means.The FAT32 or NTFS file system found in various versions of Windows stores files with both a short name and a long name. steve number2.exe is the long file name. The short file name is probably something like steven~1.exe. (You can verify this by running a DIR /x command against the directory where steve number2.exe exists).

Normally you reference files with their long file name by enclosing them in quotes. Since the START command thinks that quoted literals are the Window title, you have to workaround the problem by using the short file name.

Use the short file name in your START command.

I hope this enough to get you started. Don't be afraid to experiment a bit.

Good luck.

I have no idea what you mean by w/ew/e=whateverSteve,

Show us what you have tried and the results of what happened. At this point it's IMPOSSIBLE to know what is going wrong.

all i want to do is know how to write a file name t hat is more than one word, when i use quotes, it doesnt workYou can't. Due to the way the START command interprets parameters, a quoted literal is used as the Window title. That said, you need to use the DOS 8.3 short name for your file. A DIR /x command in the directory where steve number2.exe resides will list the short name. Use that in your START command.

Haven't we been on this ride before? and i told you that i dont know what a /x means, or how to use it...or where to use it

-sDIR is the command and /x is the switch that controls the command. Just type it like this...

DIR /x C:\Steve

C:\Steve should be replaced with the correct path to your exe file.
The easy way to make your exe file run would be to rename it with an underscore, from steve number2.exe to steve_number2.exe.
As long as it doesn't mess up any other programs that might use steve number2.exe.

3947.

Solve : Stdin to file?

Answer»

Is it possible in dos batch to copy standard input to FILE?

And how?

Thanks,

XBronaYou can write it with &GT;>file.txt (for EXAMPLE)
With > it makes a NEW file.

uli> is standard output i think.

copy con might SERVE the purpose.

3948.

Solve : issue with xcopy?

Answer»

HI,

I was wondering if anyone might be able to help me here.

I've been using xcopy to perform a backup and noticed that the xcopy only copy files til the third sub-directories. I mean there are some missing files in the destination(that didnot get copied). I just happen to compare the source and the destination on the number of files copied across.

this is how my batch file looks like

c:\xcopy x:\projects\050100 \\myotherIPAddress\SharedDocs\Projects\050100 /s/e/y/m

the reason i put /m is because i simply only want to copy if the files got changed otherwise don't copy again.

Just wonder if you could give me some advice here.

Thank you in advance
Look at RoboCopy perhaps ... http://www.ss64.com/nt/robocopy.html

Hope it's of some help to you.CameronY,

I thought the option /D is for modified files only. I can't find the /m option documented anywhere. Are you using XP?

http://dostips.cmdtips.com/DosCommandRef.htm#xcopyAll,
I don't use XCOPY , I use ROBOCOPY.

However, the /m option in XCOPY reads ...
/M Copies only files with the archive attribute set,
turns off the archive attribute.


I use ROBOCOPY on the following OS's ... Win2K (std & ADV SERVER), Win2K3 (various flavours), WixXP Pro.
All without issues.

Hope that helps some.Sorry, this question really was for [highlight]associates[/highlight] No probs.

Happy to have gotten you an answer anyways.

Having another look, you should try the following:

c:\xcopy x:\projects\050100 \\myotherIPAddress\SharedDocs\Projects\050100 /s/e/y/D

As [highlight]DosItHelp[/highlight] illuded to. You can REMOVE the /M UNLESS you are concentrating on the archive attribute.

Hope that solves your PROBLEM.

3949.

Solve : PARTITION QUESTION?

Answer»

gateway le 500 came loaded w/ windows me. I tried to upgrade this thing a couple of years ago and didn't delete the old partition before installing the windows xp. since then, it won't let me into windows at all, either version. what should I do about this. I have lost the windows xp software also.
Well you will NEED to load some form of Windows on there to make it functional. Do you have ANY CD's? If no,you will need to get ONE, your pick which.no, but can I create a recovery disk from another computer, such as an hp??No, those are geared to a particular make and model number and it will not work. (Even if it did, you would be violating the EULA. That means piracy to Bill Gates!)That won't do enough, I'm afraid. what are my options. when I reboot the computer the gateway logo shows then it goes to the screen that asks if you want to load in safe mode ETC..., no matter what i pick it will say windows xp home edition for about 1 second, then a blue screen next ( which I think is a error screen) for about 1 second then it restarts again. the error screen doesnt stay long enough for me to know what it's saying.See the first response up there. will the 6 boot disks that i keep reading about help any?...........

I'm tempted to leave my post at that, but that would be confusing. Yes, if you have bootdisks, that would be of great assistance to you.Without a Windows CD to install with, what are you going to do with bootdisks?xp home edition is installed on the computer but it does some kind of error message then reboots. I was thinking maybe I could use the boot disks to get to the screen that would allow me to delete a partition, and make windows xp work correctly. Maybe i'm ways from reality in thinking this way. I would just hate to spend another $100 on a another upgrade cd, I would rather go back to windows me, if that's possible. I'm open for any suggestions.Do you still have the COA, if not the XP software? If you have the COA and #, you could reload a friends software using your legal number, if it is the same Home and Service Pack you purchased.From Wikipedia:

Quote

A boot disk is a removable digital data storage MEDIUM, normally read-only, that can load (boot) an operating system or utility program.

GX1_Man, if XP is loaded on the machine, and the bootdisks for it are there, could it not allow nsy to at least back up important files? Forgive me if I'm wrong, but I have to know this.I have the serial number and product key for windows me only. I lost everything for xp. Or maybe I should say that a week after the purchase, it mysteriously vanished. I no longer have the restore disk from gateway w/ the windows me on it.Quote
GX1_Man, if XP is loaded on the machine, and the bootdisks for it are there, could it not allow nsy to at least back up important files? Forgive me if I'm wrong, but I have to know this.

I think both installations of WIndows are FUBAR'ed.He can SLAVE that drive to another machine if anything important is there, use a Linux Live CD, etc.
3950.

Solve : hi everybody!?

Answer»

hi guys, i just got into Dos today and i absalutly love it!
i was at school and was screwing around because i got irritated that i could not open anything. so FINALLY after trying some stuff i got into the CMD.exe (i know a thing or 2 about computers)
so then i typed some stuff and somehow i found out i had to type NET to see some cool letters and numbers and then the school computer GUY came up and got mad at me. i was so surprised i did SOMETHING like that that i didn't really pay attention to what she said. anyway, so i come home and look up some cool cmd commands and i sw this forum and i have learned a couple of things in the past 30 minutes and i love working with cmd.

i want to learn more about dos and cmd and have no intrest in making virusses or hacking something. but i do want to know how to do it just so i can say i can do it

well hope you guys can help me out on my further days on the forums.

cya!I would recommend a good DOS or command line book. That way you have a firm understanding of the basics, which cannot be done properly in a forum.

We could show you some cool TRICKS, but you would learn more the other way.The librarian at my school dislikes everything I do too...

She thinks that alt+tab (shuffle between windows w/o mouse) is some sort of VIRUS

"The screen changed!!! And you didnt move your mouse!!! HACKER!!!"

Best of luck
haha thats pretty funny.
ok a book, i tried books before..not my style but k:) thanks for the helpjust type in help it shows u comands thent ehres a way to give a better discriptitonQuote

just type in help it shows u comands thent ehres a way to give a better discriptiton



Gosh, Bil your typing in worse than mine!!!

What school has DOS nowadays?
There is no cmd.exe in DOS.
Are you talking about a command prompt in XP?
If so, go to www.bootdisk.com & download a Win98 bootdisk, WRITE it to a floppy (if you have a floppy), boot your computer from it & then play.
That's DOS. It's less user friendly but to me that means more fun.Good point.