Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Dos Batch File To Get User Input

- - - - -

  • Please log in to reply
20 replies to this topic

#1
PeonPower

PeonPower

    Newbie

  • Member
  • 15 posts
  • Joined 21-February 05
Hi all,

thanks to these boards I've created a nice unattended CD with WPI to install applications afterwards. But I still have one little problem.

This CD will be used by the company I'm currently working for, meaning this CD will be used on a lot of different pc's all on the same network.

Because of this I would have to edit the username/computername afterwards but even then the productkey would still be the same(we still have a lot of OEM key's) so this is not an option.

So to prevent this I made a small batch file to be run from a bootable floppy disk which asks for user input and then creates an answer file, afterwards the setup should run.

Here is the current batch file:

@ECHO OFF


rem ---------------------------------------------
rem USER INPUT
rem ---------------------------------------------
INPUT "enter productkey:" productkey
INPUT "enter username:" username
INPUT "enter computername:" computername

rem ---------------------------------------------
rem REMOVE OLD ANSWER FILE
rem ---------------------------------------------

DEL a:\WINNT.SIF

rem ---------------------------------------------
rem WRITE NEW ANSWER FILE
rem ---------------------------------------------
ECHO;SetupMgrTag >>a:\WINNT.SIF
ECHO [Data] >>a:\WINNT.SIF
ECHO     AutoPartition=1 >>a:\WINNT.SIF
ECHO     MsDosInitiated="0" >>a:\WINNT.SIF
ECHO     UnattendedInstall="Yes" >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Unattended] >>a:\WINNT.SIF
ECHO     UnattendMode=FullUnattended >>a:\WINNT.SIF
ECHO     OemSkipEula=Yes >>a:\WINNT.SIF
ECHO     OemPreinstall=YES >>a:\WINNT.SIF
ECHO     TargetPath=\WINDOWS >>a:\WINNT.SIF
ECHO     UnattendSwitch="yes" >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [GuiUnattended] >>a:\WINNT.SIF
ECHO     AdminPassword="xxxxxx" >>a:\WINNT.SIF
ECHO     EncryptedAdminPassword=NO >>a:\WINNT.SIF
ECHO     AutoLogon=Yes >>a:\WINNT.SIF
ECHO     AutoLogonCount=1 >>a:\WINNT.SIF
ECHO     OEMSkipRegional=1 >>a:\WINNT.SIF
ECHO     TimeZone=110 >>a:\WINNT.SIF
ECHO     OemSkipWelcome=1 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [UserData] >>a:\WINNT.SIF
ECHO     ProductKey=%productkey% >>a:\WINNT.SIF
ECHO     FullName=%username% >>a:\WINNT.SIF
ECHO     OrgName="Koster" >>a:\WINNT.SIF
ECHO     ComputerName=%computername% >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Display] >>a:\WINNT.SIF
ECHO     BitsPerPel=16 >>a:\WINNT.SIF
ECHO     Xresolution=1024 >>a:\WINNT.SIF
ECHO     YResolution=768 >>a:\WINNT.SIF
ECHO     Vrefresh=70 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [TapiLocation] >>a:\WINNT.SIF
ECHO     CountryCode=31 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [RegionalSettings] >>a:\WINNT.SIF
ECHO     LanguageGroup=1 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Branding] >>a:\WINNT.SIF
ECHO     BrandIEUsingUnattended=Yes >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Proxy] >>a:\WINNT.SIF
ECHO     Proxy_Enable=1 >>a:\WINNT.SIF
ECHO     Use_Same_Proxy=1 >>a:\WINNT.SIF
ECHO     HTTP_Proxy_Server=winroute:3128 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Identification] >>a:\WINNT.SIF
ECHO     JoinDomain=Koster >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Networking] >>a:\WINNT.SIF
ECHO     InstallDefaultComponents=Yes >>a:\WINNT.SIF
ECHO. >>a:\WINNT.SIF
ECHO [GuiRunOnce] >>a:\WINNT.SIF
ECHO  %systemdrive%\install\wpi\wpi.hta >>a:\WINNT.SIF


rem ---------------------------------------------
rem START INSTALLATION
rem ---------------------------------------------
rem D:\i386\WINNT.EXE

As you can see I put a REM before the setup command, this is because when the setup should start running it gives me an error that it doesn't know where to put the windows XP install file(probably because of the ramdisk the bootdisk created on c:\)

So I thought I'd be smart and get the input put it in the answer file then reboot and start the install from CD(requires me to eject the floppy for a while but that's not THAT big a deal) However, I have not been able to find any reboot command for dos.

So in short my question is, does anyone know how to run the setup after inputting the commands to the answer file on the floppy drive. Maybe there is some other way to do this that I don't know but this is the only option I could think about.

Any help would be appreciated


How to remove advertisement from MSFN

#2
angadsingh007

angadsingh007

    (¯`·._.·[ StÉAlth ]·._.·´¯)

  • Member
  • PipPip
  • 149 posts
  • Joined 17-February 05
Hope this helps

http://www.conklinsy...code/reboot.php
ForumNation - Get in. Get Addicted.

#3
PeonPower

PeonPower

    Newbie

  • Member
  • 15 posts
  • Joined 21-February 05
Thanks but this doesn't seem to be what I'm looking for. =[

When I'm booting from a floppy there is only 1 active partition (the one the bootdisk creates) And I tried, but I can't reboot to the active partition.

#4
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,419 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
Here This Should Help You
I Made It Based On Your Post
@ECHO OFF
cls && mode 55,5 && Color F1
Title Add User Info To Winnt.sif

:UserProduckey
cls && Color F1
echo.
echo Please Enter Windows Product Key
set /p Key= Here -^> 
cls && Color 1f
echo.
echo %key%
ping -n 2 127.0.0.1>nul

:Username
cls && Color F1
echo.
echo Please Enter A User Name
set /p Uname= Here -^> 
cls && Color 1f
echo.
echo %Uname%
ping -n 2 127.0.0.1>nul

:Computername
cls && Color F1
echo.
echo Please Enter A Computer Name
set /p Cname= Here -^> 
cls && Color 1f
echo.
echo %Cname%
ping -n 2 127.0.0.1>nul

cls && Color F1
Title OutPut The Sif
echo.
echo Processing...
if exist a:\WINNT.SIF DEL a:\WINNT.SIF
ping -n 1 127.0.0.1>nul
rem ---------------------------------------------
rem WRITE NEW ANSWER FILE
rem ---------------------------------------------
ECHO;SetupMgrTag >>a:\WINNT.SIF
ECHO [Data] >>a:\WINNT.SIF
ECHO     AutoPartition=1 >>a:\WINNT.SIF
ECHO     MsDosInitiated="0" >>a:\WINNT.SIF
ECHO     UnattendedInstall="Yes" >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Unattended] >>a:\WINNT.SIF
ECHO     UnattendMode=FullUnattended >>a:\WINNT.SIF
ECHO     OemSkipEula=Yes >>a:\WINNT.SIF
ECHO     OemPreinstall=YES >>a:\WINNT.SIF
ECHO     TargetPath=\WINDOWS >>a:\WINNT.SIF
ECHO     UnattendSwitch="yes" >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [GuiUnattended] >>a:\WINNT.SIF
ECHO     AdminPassword="xxxxxx" >>a:\WINNT.SIF
ECHO     EncryptedAdminPassword=NO >>a:\WINNT.SIF
ECHO     AutoLogon=Yes >>a:\WINNT.SIF
ECHO     AutoLogonCount=1 >>a:\WINNT.SIF
ECHO     OEMSkipRegional=1 >>a:\WINNT.SIF
ECHO     TimeZone=110 >>a:\WINNT.SIF
ECHO     OemSkipWelcome=1 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [UserData] >>a:\WINNT.SIF
ECHO     ProductKey=%key% >>a:\WINNT.SIF
ECHO     FullName=%Uname% >>a:\WINNT.SIF
ECHO     OrgName="Koster" >>a:\WINNT.SIF
ECHO     ComputerName=%Cname% >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Display] >>a:\WINNT.SIF
ECHO     BitsPerPel=16 >>a:\WINNT.SIF
ECHO     Xresolution=1024 >>a:\WINNT.SIF
ECHO     YResolution=768 >>a:\WINNT.SIF
ECHO     Vrefresh=70 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [TapiLocation] >>a:\WINNT.SIF
ECHO     CountryCode=31 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [RegionalSettings] >>a:\WINNT.SIF
ECHO     LanguageGroup=1 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Branding] >>a:\WINNT.SIF
ECHO     BrandIEUsingUnattended=Yes >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Proxy] >>a:\WINNT.SIF
ECHO     Proxy_Enable=1 >>a:\WINNT.SIF
ECHO     Use_Same_Proxy=1 >>a:\WINNT.SIF
ECHO     HTTP_Proxy_Server=winroute:3128 >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Identification] >>a:\WINNT.SIF
ECHO     JoinDomain=Koster >>a:\WINNT.SIF
ECHO.  >>a:\WINNT.SIF
ECHO [Networking] >>a:\WINNT.SIF
ECHO     InstallDefaultComponents=Yes >>a:\WINNT.SIF
ECHO. >>a:\WINNT.SIF
ECHO [GuiRunOnce] >>a:\WINNT.SIF
ECHO  %systemdrive%\install\wpi\wpi.hta >>a:\WINNT.SIF
ping -n 1 127.0.0.1>nul



GunSmokingMan



#5
angadsingh007

angadsingh007

    (¯`·._.·[ StÉAlth ]·._.·´¯)

  • Member
  • PipPip
  • 149 posts
  • Joined 17-February 05
I have a attached a simple application - REBOOT.COM

It will only work in a 16-bit PURE Dos-mode environment..

COMMAND : REBOOT .. thats all

Hope this works for u

P.S.: There are 2 files in the rar archive.. .not sure which one works.. tell me bout it ..

Attached Files


ForumNation - Get in. Get Addicted.

#6
-I-

-I-

    win2k Freak

  • Member
  • PipPipPipPip
  • 639 posts
  • Joined 23-November 04
Oke i can see why you are doing this,
or cant i?

i figured you wanted to be able to do this UA- install, and
Not have to wait for the GUI-Setup to enter your password????
Because else you could have just leave those 2 values
( licencekey and computer name) undefined,
and your setup would have asked you for them...

so if this is the case... i'd say gotya...

But the way i see this,
> you might want to concider that flopy disk are not to efficient
and breake or get lost easely...

it would be easyer to
pre-format you Hdisk, for exampe using a tool like
'partionmagic for DOS' after that, run your batch file
and put the created awnser .file on your %systemdrive% and
Set you filesystem option in winnt.sif to 'leave alone'

but if you where to do this you'd stil nead to run winnt.exe
in MS-mode to be able to pass the location of winnt.sif

Running Windows NTxxx setup in dosmode isnt the best
and certainly not the fastest way as we probebly all know...

My guess would be to try and change txtsetup.sif to run your batch file
(im not realy sure it this can do the trick
yet i cant think of a reason why it shouldn't either,
(look at the drivers from cd section why i think it is possible))

If indead posible you'd now have the best of both sides.
(not running NTsetup in dos-mode,
and being able to set your own OEM-keys and machine name
a bit sooner than in a normal windows setup...
(and without the hassle of a floppydisk)...

If anyone wants to try...
I, too, would be curious to the results,..
[message of the .....whatever]
Dont be a luser*!*@msnf.org: Ask Good Questions. , read the microsoft guide, google-it-yourself
Do NOT use pirated software, there is free opensource software for allmost every task you seak!
Where is the "any key" ???

#7
JPamplin

JPamplin

    format c: /u - It is your desssssstiny.

  • Member
  • PipPip
  • 143 posts
  • Joined 06-January 04
You just need to specify where the WINNT.SIF file is when you start WINNT. IT only reads it at the very beginning (you don't need to have the floppy in for the rest of the install cycle.

I use the following:

@d:\Install\WinXP\i386\winnt /s:d:\Install\WinXP\i386 /u:d:\batfiles\XPAPPS.sif

Just put your path and filename after /u: and you'll be fine.

JP

#8
angadsingh007

angadsingh007

    (¯`·._.·[ StÉAlth ]·._.·´¯)

  • Member
  • PipPip
  • 149 posts
  • Joined 17-February 05
Another place to get info on shutdowns and reboots

http://www.msfn.org/...11
ForumNation - Get in. Get Addicted.

#9
PeonPower

PeonPower

    Newbie

  • Member
  • 15 posts
  • Joined 21-February 05
THanks for all the replies, looks like I have some new stuff to try =]

Here This Should Help You
I Made It Based On Your Post
...
batch file snipped

Hmm, doesn't this do the same my batch file did only a bit prettier or am I missing something? Still gonna try it of course =]

I have a attached a simple application - REBOOT.COM

It will only work in a 16-bit PURE Dos-mode environment..

COMMAND : REBOOT .. thats all

Hope this works for u


Looking good, I'll see if I can test it on my own pc this weekend. I'll need to put my floppy drive back into my pc then though o_O

Oke i can see why you are doing this,
or cant i?

i figured you wanted to be able to do this UA- install, and
Not have to wait for the GUI-Setup to enter your password????
Because else you could have just leave those 2 values
( licencekey and computer name) undefined,
and your setup would have asked you for them...

so if this is the case... i'd say gotya...

Yeah I would like to keep it completely unattended apart from entering username, computername and productkey at the start as well as choosing the partition to install on.

My guess would be to try and change txtsetup.sif to run your batch file
(im not realy sure it this can do the trick
yet i cant think of a reason why it shouldn't either,
(look at the drivers from cd section why i think it is possible))


I'll give this a try on monday, I'm gonna try all the new possibilities I've seen in this thread and see what works best =]

#10
PeonPower

PeonPower

    Newbie

  • Member
  • 15 posts
  • Joined 21-February 05
Ok I tried the first reboot.com and it works perfectly!

It's a shame that I will have to take out the floppy and put it back in but it seems to be the only way to get early user input.

I do have one last question though, how do I make the batch file ask for me to press enter to continue before starting the reboot. Otherwise it would just start rebooting when it's done writing to the floppy. This would be easy to miss making it an infinte reboot loop

Once again thanks for all the help, looking forward to using it for the first time on a new pc

#11
sh0k0nes

sh0k0nes
  • Member
  • 7 posts
  • Joined 14-November 03
Okie.
Just had a quick browse thru ur request and I'm tired so I might be answering a completely different question!!
:-))

Just wanna check a few details.
1. Will the drive ure installing on already be prepared? eg. fdisk'd or formatted.
2. Is there space on ur floppy for a few tools? maybe 100k
3. Why do u have to take out the floppy and put it back in?

Kev



Kev

#12
PeonPower

PeonPower

    Newbie

  • Member
  • 15 posts
  • Joined 21-February 05

Okie.
Just had a quick browse thru ur request and I'm tired so I might be answering a completely different question!!
:-))


Heh ok =]

Just wanna check a few details.
1. Will the drive ure installing on already be prepared? eg. fdisk'd or formatted.

Already formatted with NTFS. This unattended install will be for both new pc's that just came in, or pc's that just need a new install.

2. Is there space on ur floppy for a few tools? maybe 100k


There still is space left. currently just a bootdisk with input.com, reboot.com and my batch file added

3. Why do u have to take out the floppy and put it back in?



If I don't take it out this is what happens:

I turn on the PC
PC boots from floppy and runs the batch file
I input the needed info and the batch file autoreboots
PC boots from floppy once again

See the problem? =p

SO to get the system to boot from the CD I have to take out the floppy until the install starts, after which I can put it back in so the setup can read the answer file on the floppy

#13
sh0k0nes

sh0k0nes
  • Member
  • 7 posts
  • Joined 14-November 03
Easy life!
Heheh.
1 more question.
Y do u need 2 reboot?

Kev

#14
PeonPower

PeonPower

    Newbie

  • Member
  • 15 posts
  • Joined 21-February 05
That's to start the install from the CD instead of using the command prompt install, which is pretty crap from what I've heard(never tried it myself)

#15
sh0k0nes

sh0k0nes
  • Member
  • 7 posts
  • Joined 14-November 03
Soory about the questions.
Just 1 more. Really!!
The command prompt way isn't much different, just adds a tiny amount of extra time. Is this a problem?
My unattended approach means u could get everything done with no rebooting and only removal of floppy once.
If the drive isn't formatted or anything it would mean just 1 reboot and 1 floppy removal.
Slightly more scripting initially but way easier to put ur feet up after.

Kev

#16
PeonPower

PeonPower

    Newbie

  • Member
  • 15 posts
  • Joined 21-February 05

Soory about the questions.
Just 1 more. Really!!
The command prompt way isn't much different, just adds a tiny amount of extra time. Is this a problem?
My unattended approach means u could get everything done with no rebooting and only removal of floppy once.
If the drive isn't formatted or anything it would mean just 1 reboot and 1 floppy removal.
Slightly more scripting initially but way easier to put ur feet up after.

Kev

<{POST_SNAPBACK}>


Well some extra time shouldn't be any problem since it's all unattended anyway. But does it support NTFS or will I have to convert later on? (just 1 command I know =])

Other than that let's hear it =p

#17
`Felix`

`Felix`

    MSFN Contributor

  • Member
  • PipPipPip
  • 481 posts
  • Joined 28-July 04

P.S.: There are 2 files in the rar archive.. .not sure which one works.. tell me bout it ..

<{POST_SNAPBACK}>


The one (20bytes) in the "2" directory/folder works :thumbup
"I seek not to know all the answers, but to understand the questions."
- Kwai Chang Caine.


Want to setup your default user/all users unattended install easy? - Simplify iT - GuidesCheers,
FeLiX

#18
PeonPower

PeonPower

    Newbie

  • Member
  • 15 posts
  • Joined 21-February 05

P.S.: There are 2 files in the rar archive.. .not sure which one works.. tell me bout it ..

<{POST_SNAPBACK}>


The one (20bytes) in the "2" directory/folder works :thumbup

<{POST_SNAPBACK}>


Heh, I used the one in the "1" directory and it works fine as wel =]

#19
sh0k0nes

sh0k0nes
  • Member
  • 7 posts
  • Joined 14-November 03
OK.
(Best Shakespearean voice)..My approach is thus:-
Do a search for ramdrive.sys, strings.com and setparam.exe. Setparam was on NT Res Kit I believe. If not I can send u them.

Setup dos boot disk as normal with a ramdrive of 1 or 2 megs.
U r gonna stick ur unattended file in here. I've found that floppies these days aren't as tough as the old days. 2 much reading and writing mashes them.

Keep a semi-populated unattended file on the floppy which is gonna be copied to the ram drive. Include things like all the necessary labels and stuff but leave out the bits u wanna change.
eg. Mine kinda looks like this.

;SetupMgrTag
;
;Kev da Butcher

[Data]
Autopartition=1
blah
[Unattended]
blah
[UserData]
ProductID=12345-67890- blah
FullName=
OrgName=
ComputerName=

So basically, any areas that u wanna input urself get left blank.

Then in ur autoexec.bat u call strings.com.
a:\dos\strings.com usrname=ask Type in User Name

This stores the name as a variable which u access by-

a:\dos\setparam %ramdrv%\unattend.txt UserData FullName %usrname%

And u repeat this for any values u want to append.

eg. say u want to add to domain:
a:\dos\strings.com domname=ask Enter Domain Name
a:\dos\setparam %ramdrv%\unattend.txt Identification JoinDomain %domname%

Then of course winnt /u:%ramdrv%\unattend.txt /s:cdrom:\i386

I've used this technique to create massive monster unattends that include different settings for NT, 2K, XP and Server 2K3 using static ip, dhcp, and all the other bits the unattend can control.

Kev

#20
PeonPower

PeonPower

    Newbie

  • Member
  • 15 posts
  • Joined 21-February 05
Thanks! I'll give it a try, looks like might work better then what I have now. One question though:

I already have a ramdisk created when the PC boots from the floppy disk, but when I start the setup it can't file any partition to install to.

c:\ is ramdisk, d:\ is CDROM and the normal NTFS partition(s) is not reachable from the command prompt.

So the setup doesn't know where to install to, I aborted the setup there so it me be that you can still choose a partition but I'm quite sure it wasn't possible.

#21
sh0k0nes

sh0k0nes
  • Member
  • 7 posts
  • Joined 14-November 03
I think uve confused the setup proggie.
Make b: the ramdisk.

Kev




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN