Computing.Net > Forums > Disk Operating System > Making a .bat file to get input NT

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.

Making a .bat file to get input NT

Reply to Message Icon

Name: Vson
Date: March 20, 2003 at 02:29:01 Pacific
OS: NT 4.0 SP5
CPU/Ram: 166/128
Comment:

Hello.
My problem is exact like the problem "making a .bat file to get input" in DOS\Page 1...
BUT it is in NT 4.0. Like the answer from Secret_doom....but like he sayes, "There are other methods to get user input om such OS's. Please help me....

/jonas



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: March 20, 2003 at 13:25:27 Pacific
Reply:

Here I am!

Well, the methods for that issue differ a lot from OS to OS. I have 3 basic methods, one of them specific to NT4 (and perhaps under), since SET/P won't work on it, like on Win 2000 and XP. Here's it:

@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=> %temp%.\input.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>> %temp%.\input.com
echo @]yI?@xAp~sA`LZNt@x[}?MGI@]A?nsl@]}G@tLC?sBZ`LBL`_jN0xxxxx>> %temp%.\input.com
for /F "tokens=*" %%I in ('%temp%.\input.com') do set INPUT=%%I
del %temp%.\input.com

That method, which uses a little assembly code, is also compatible with Win 2K and XP, but not with Win9x and DOS (actually the asm is compatible, but the FOR cmd to handle the output isn't).

-- Leonardo Pignataro - Secret_Doom --

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

__________________________________________________________________________________________


0

Response Number 2
Name: vson
Date: March 22, 2003 at 15:06:52 Pacific
Reply:

THANKS....you saved me..


0

Response Number 3
Name: vson
Date: March 23, 2003 at 03:31:20 Pacific
Reply:

Hello again secret_doom.
Sorry to bother you again. But i don't get the file to work. Here is the Problem, it look's like this.
@echo off
echo.
echo [Jonas Backupmenu]
echo.
echo ++++++++++++++++++++++++++++++++++++++
echo + 1. Userdata Backup Trough Choice +
echo + 2. Quit +
echo ++++++++++++++++++++++++++++++++++++++
echo.
CHOICE /C:12 Choose Option.

IF ERRORLEVEL 2 GOTO :END
IF ERRORLEVEL 1 GOTO :REMOTE


:REMOTE
net use q: \\[server]\XPusers
cls

:INPUT
cls
echo.
set INPUT=
set /P INPUT=Type UserName: %=%
if "%INPUT%"=="" goto input
Cls
echo.
echo You Typed UserName: %INPUT%

echo.
CHOICE /C:YNC Is This Correct?

IF ERRORLEVEL 3 GOTO :END
IF ERRORLEVEL 2 GOTO :INPUT
IF ERRORLEVEL 1 GOTO :MD


:MD
cls
md o:\users\%INPUT%
echo The Folder Was Succesfuly Created.
echo.
Pause
goto :end

:END
cls
echo.
Pause
Exit

And after this the file is going on with a "robocopy" command... and i want to use the (for exampel) %input% to use in the rest of the bat file. But like you said the file is NOT working with input /p. But it works in xp. Can you help me with that. The file answer you sen me, did i not get to work...maby i do something wrong.

//Jonas


0

Response Number 4
Name: Secret_Doom
Date: March 24, 2003 at 14:32:54 Pacific
Reply:

You're using 2 methods which aren't compatible with NT4. The "SET/P" to get user input, as I said before, and the usage of CHOICE.COM. That is an external application that is not present on NT systems by default. Though the file will work if the system has the application, it's unlikely to do so. You would probably need to include the application together with the batch file on eventual distribution of the script, which I consider bad, since there are easy ways around it. Nevertheless, if the script is for personal use only, it's OK using CHOICE.COM (but SET/P won't work whatsoever).

About the script I posted earlier, it ought to work. You see, if you run that script, it will simply wait for input with a final [ENTER], and will send that input to the %input% variable. It's up to you to add addaptions like a message telling user to enter input. Here's a sample:

@echo off

echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=> %temp%.\input.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>> %temp%.\input.com
echo @]yI?@xAp~sA`LZNt@x[}?MGI@]A?nsl@]}G@tLC?sBZ`LBL`_jN0xxxxx>> %temp%.\input.com

:INPUT
cls
echo.
echo Type UserName:
for /F "tokens=*" %%I in ('%temp%.\input.com') do set INPUT=%%I
if "%INPUT%"=="" goto input
cls
echo.
echo You Typed UserName: %INPUT%

del %temp%.\input.com

Only delete the file %temp%.\input.com when you've already used as many times as you want (e.g.: on the end of the file) so you won't need to create it again.

-- Leonardo Pignataro - Secret_Doom --

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

__________________________________________________________________________________________


0

Response Number 5
Name: vson
Date: March 27, 2003 at 06:56:27 Pacific
Reply:

Thanks. That works fine.



0

Related Posts

See More



Response Number 6
Name: tobias
Date: April 2, 2003 at 07:02:26 Pacific
Reply:

Hi secret_doom.

It seems you may be able to help me.

I try to write the simplest of batch files using the choice-command:
choice /c:123 please choose option

when executed, the choice is not displayed and i get the message(roughly translated):
"command spelled incorrectly or not found. check spelling and variable 'PATH'."

thanks for hints and tips.
Tobias.


0

Sponsored Link
Ads by Google
Reply to Message Icon






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: Making a .bat file to get input NT

Making a .bat file to get input www.computing.net/answers/dos/making-a-bat-file-to-get-input/12821.html

How to Make a .bat file 2 run programs on usb www.computing.net/answers/dos/how-to-make-a-bat-file-2-run-programs-on-usb/16975.html

I want to make a bat file www.computing.net/answers/dos/i-want-to-make-a-bat-file/2601.html