Computing.Net > Forums > Disk Operating System > Batch files in XP

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch files in XP

Reply to Message Icon

Name: Mark
Date: October 3, 2002 at 17:05:38 Pacific
OS: Windows XP
CPU/Ram: 1Gig/256MB
Comment:

Currently I'm enrolled in a Operating Systems class, and to complete the DOS section, we have to write a batch file. I've had previous experience with DOS up until 5.0... Now since Commandline DOS has been restrictive in some MS DOS commands I can't quite figure out how to query a user for his name and then use that name during some output on the screen.

For example... I would like to start my batch file by asking the user his name. Then during certain command executions I would like the program to say, "Ok [username], we're now going to blah blah blah..."

I've tried numerous batch files from certain sites but none that I've tried have worked in the NT environment. Some seem to use the FC CON NULL command... but the 2000 Command line DOS does not recognize that usage.

Does anyone have any idea how I can make a batch file utilize string input requested from a user while the batch file is running?

Thanks,
Mark



Sponsored Link
Ads by Google

Response Number 1
Name: bitbyte
Date: October 3, 2002 at 18:36:21 Pacific
Reply:

hi, look at my page there's a pgm that can help you (under download)

it reads the kbs input and writes it into a file, you can print that file with any pgm to tell "OK [kbd typing]"

http://plop.at

if you need changes with that program, then tell me

see ya


0

Response Number 2
Name: Secret_Doom
Date: October 4, 2002 at 11:13:32 Pacific
Reply:

You're right: this FC CON NUL (not NULL) method won't work on NT systems. However, there's a much easier way to do it on such systems:

set /P NAME=Type your name:
echo Hello, %NAME%!

You could include some error checking, and also change a little the text format:

echo Type your name:
:input
set /P NAME=
if "%NAME%"=="" goto input
echo Hello, %NAME%

This last method will display the input request in a line, and get the input on the next one (differently from the first method, which will do both tasks on the same line). It does also check if user did enter something. If user didn't enter nothing, and the %NAME% variable has no value, the batch loops and gets the input again.

BTW, there's no DOS under Windows XP. There's a command line interpreter, CMD.EXE, which looks like DOS's command line interpreter, COMMAND.COM. However, that is not DOS, not at all.

Your teacher (or whatever) from the class shouldn't refer to CMD.exe as DOS, because that leads students to think there's DOS on NT systems, and there isn't.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 3
Name: Mark
Date: October 6, 2002 at 17:06:34 Pacific
Reply:

Thanks a bunch... :)

No... she's not really referred to it as DOS... we call it Command Line. BAH... I hate it... they took away the choice command. :P

Thanks for your replies though.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


BIOS Disabled? share directories wiht MS...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Batch files in XP

Batch File delete. www.computing.net/answers/dos/batch-file-delete/12718.html

batch files in winxp www.computing.net/answers/dos/batch-files-in-winxp/13912.html

Batch File Help www.computing.net/answers/dos/batch-file-help/12337.html