Computing.Net > Forums > Disk Operating System > dos input to bat file

dos input to bat file

Reply to Message Icon

Original Message
Name: warren
Date: August 6, 2003 at 03:37:27 Pacific
Subject: dos input to bat file
OS: dos
CPU/Ram: 500/256
Comment:

I am building an unattended install of windows 2000 for my network. However I want the "computer name" line (in unattend.txt) to be input by a user at a DOS prompt.

i have the file change.exe which works with the following command (located on a:)

a:\change [txt file name] "word in file" "new word in file"

eg:
change the word warren in file unattend.txt to monkey

a:\change a:\prep\unattend.txt "warren" "monkey"

instead of monkey i am using %input% and the following line at the start of the script

FOR /F "tokens=*" %%A IN ('TYPE CON') DO SET INPUT=%%A

so all in all i have

@ECHO OFF
ECHO Type in the computer name.
ECHO Then Enter followed by F6 and then Enter again.

FOR /F "tokens=*" %%A IN ('TYPE CON') DO SET INPUT=%%A

a:\change a:\prep\unattend.txt "warren" "%INPUT%"

this works in a cmd prompt in windows, but not at a dos prompt?? any ideas anyone



Report Offensive Message For Removal


Response Number 1
Name: Secret_Doom
Date: August 6, 2003 at 20:39:13 Pacific
Subject: dos input to bat file
Reply: (edit)

On DOS real mode, another method must be used. Read my FAQ:

FAQ #06 - Get user input

However, the script on that URL only works on DOS/Win9x, not on NT systems. Here follows a solution that will work on all those systems:

:: ========================================================
:: Author: Leonardo Pignataro (secret_doom@hotmail.com)
:: ========================================================
:: Get user input and save on an environment variable.
:: ========================================================
:: The process is based on an assembler code, which should
:: make the compatiblity of this script very wide.
:: ========================================================
@echo off
echo `h}aXP5y`P]4nP_XW(F4(F6(F=(FF)FH(FL(Fe(FR0FTs*}`A?+,> %temp%.\input.com
echo fkOU):G*@Crv,*t$HU[rlf~#IubfRfXf(V#fj}fX4{PY$@fPfZsZ$:J=v$+C>> %temp%.\input.com
echo cCdO06s$W?DAj{?_@$H]44e.]tI:PAJr$W@U'j{?_@5oA07tbLV?=?sEY5lY>> %temp%.\input.com
echo zH]'=v\{+ZHu#>> %temp%.\input.com
echo Type input:
%temp%.\input.com > %temp%.\t1.bat

:: Set variable name to save input below
call %temp%.\t1.bat MyInput

for %%? in (input.com t1.bat) do del %temp%.\%%?

-- Leonardo Pignataro - Secret_Doom --

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

__________________________________________________________________________________________


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: dos input to bat file

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge