MSFN Forum: Batch file to let choose an answer file - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Batch file to let choose an answer file Rate Topic: -----

#1 User is offline   erik_demon 

  • Master Chief
  • PipPip
  • Group: Members
  • Posts: 253
  • Joined: 22-August 04

Posted 31 May 2005 - 05:13 AM

Hey everybody :hello:

I created a little batch file to let you choose your answer file before a format.

This file is for those people who install with winnt32.exe (like me :) )

The function of this script is the following:

- Find out the drive letter of the Windows XP CD (cd.txt must be on the root of the CD)
- Ask the user on which drive he wants to install
- Let's the user choose an answer file
- formats the choosen drive
- Installs XP

In order to use winnt32.exe (32-bit application) we need to use WINPE or BARTPE.

Ofcourse I tested this for myself (well, only in CMD not with a format)

What is your opinion about the batch file?
Is there anyway I can improve this? (my batch skills are not that good, so improvements are welcome)

EDIT:

NEW VERSION 15/6/2005

I added the possibility to create your own winnt.sif (at least part of them)

Attached File(s)


This post has been edited by erik_demon: 15 June 2005 - 03:44 AM



#2 User is offline   genex 

  • Group: Members
  • Posts: 9
  • Joined: 23-December 04

Posted 31 May 2005 - 10:18 AM

Lol... very gooderik_demon.

Now, only thing I need is a tutorial on how to do this thing. :P

#3 User is offline   Martin Zugec 

  • MSFN Expert
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,373
  • Joined: 24-January 04

Posted 31 May 2005 - 10:23 AM

Hmmm, I am thinking about something similar, but still different :)

HTA application, that will let you choose what you want to change and it will modify winnt.sif.

The tool for small companies that are installing computers for clients - they will set everything for unattended installation, but what you cant automate (e.g. company name etc.), they will have ability to set BEFORE installation, not during. So he will run installation, make necessary changes and leave computer.

#4 User is offline   metabaron 

  • Newbie
  • Group: Members
  • Posts: 11
  • Joined: 21-March 04

Posted 31 May 2005 - 10:39 AM

Here (french compagny), we already do it via a DOS script which set up your unattended install (Windows or Linux, depend on you).

Work pretty well !

#5 User is offline   zxfiles 

  • Group: Members
  • Posts: 7
  • Joined: 03-June 05

Posted 03 June 2005 - 09:54 AM

First time poster, because I was looking to do this same task. My plans may differ a little from the original poster.

What I'm wanting to do is have the user prompted for some pre-install questions that will edit the winnt.sif file with the appropriate changes. For example, here at the university we use static IPs instead of DHCP. So, having the network settings installed automatically doesn't work too well.

I would like to ask the user if he knows the IP address he will be using at the install that day and then it will add it to the winnt.sif file. Make sense? This would help a lot in the network based tasks, because then everything would be configured and I could perform other tasks such as joining the domain and calling install points for Office 2003.

As it stands now, I have to install XP under the default workgroup settings with no static IP and configure all of that when the installation completes. After which, I can then perform the network tasks mentioned above. It's not too much of a pain, but I would like to automate as much as possible.

Thanks.

Edit
I realize that by doing this, I lose the ability to put the winnt.sif file on the install cd. I would think I would need a boot floppy of some kind that ran a batch file prompting for the answers which in turn would edit the sif file on the floppy.

#6 User is offline   erik_demon 

  • Master Chief
  • PipPip
  • Group: Members
  • Posts: 253
  • Joined: 22-August 04

Posted 13 June 2005 - 12:36 PM

Sorry for the late response guys, I have been very busy lately :blushing:

@genex

Thanks, about that turtorial. The most import thing is that you understand how to set user imput:

SET Choice=
SET /P Choice="Is this correct? (Y/N)     "
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
IF /I '%Choice%'=='Y' (
GOTO Choose_user
)
IF /I '%Choice%'=='N' (
GOTO Install_drive
)


I find it hard to explain this because I don't know eveything about this to :D

SET /P Choice holds the batch file and asks user imput. If you type Y the variable %Choice% is equal to Y. After this, we use IF to check the value and execute a command (in this case: Goto Choose_user)

That is the most important. If you would like you can change the variable name. You can test it like this:

@ECHO OFF
SET Option=
SET /P Option="Select an option: (1 or 2)    "
IF NOT '%Option%'=='' SET Option=%Option:~0,1%
IF /I '%Option%'=='1' (
ECHO.
ECHO You Selected option 1
Pause
GOTO end
)
IF /I '%Option%'=='2' (
ECHO.
ECHO You Selected option 2
Pause
GOTO end
)

:end


I hope this helps

@Martin Zugec
Good idea! Since I use BARTPE, I believe .HTA support is avaiable. About the support for companies, check out below

@metabaron
That's great, Would you like to share it?

@zxfiles
Hi welcome :hello:

I think I found what you where looking for (and I was looking for it to :P )

Check-out this post

I tested it, and with this method you can created specific parts for your winnt.sif

This post has been edited by erik_demon: 13 June 2005 - 12:52 PM


#7 User is offline   erik_demon 

  • Master Chief
  • PipPip
  • Group: Members
  • Posts: 253
  • Joined: 22-August 04

Posted 15 June 2005 - 03:49 AM

New version available (see first post)

This version is written for my system, so if you want to use it, you need to modify it.

Since my batch skills are not that great, it may be that parts of the script can be optimized. If you see such a part, please comment :D

I tested it and for my system it works great :thumbup

EDIT:

For the winnt.sif creator, credits go to gunsmokingman who designed it (see the link in post nr. 6 )

Thanks :thumbup

This post has been edited by erik_demon: 15 June 2005 - 04:09 AM


#8 User is offline   drache 

  • Group: Members
  • Posts: 6
  • Joined: 21-June 05

Posted 22 June 2005 - 06:57 AM

what would be really cool is if there are a few winnt.sif files that have most of the answers. now, the sif file would will have to be loaded into memory at some point in time right, so why not have it make the changes to the sif file in memory. that way there wouldnt be a need for a floppy. i dont know how this could be mananged, but i think it would be really cool.

either that or a sif file somewhere on the network so it can be changed depending on how the user answers

#9 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 22 June 2005 - 09:28 AM

Other than the optimising, you suggest may be required, how are you both 'echoing to' and 'deleting from' the optical disk drive?

#10 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 29 June 2005 - 12:19 PM

erik…

#11 User is offline   erik_demon 

  • Master Chief
  • PipPip
  • Group: Members
  • Posts: 253
  • Joined: 22-August 04

Posted 29 June 2005 - 12:47 PM

sorry for the late answer, I didn't pay attention to the topic :blushing:

I do not completely understand what you mean:

Quote

how are you both 'echoing to' and 'deleting from' the optical disk drive?


I believe that you think that I use this for a CD based installed, correct?

If you mean that, it will not work. I install my computer from a second harddrive. On that drive, I can write and delete as much as I like.

You are correct when you say that this won't work with a CD install.

However...

If you change the batch file like this:

ECHO     AutoPartition=1 >>%CDROM%WINNT.SIF


to

ECHO     AutoPartition=1 >>A:\WINNT.SIF


the winnt.sif will be written to a Floppy disk. Then you could modify the batch file to let winnt32.exe find the answer file there

I hope this helps

This post has been edited by erik_demon: 29 June 2005 - 12:48 PM


#12 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 29 June 2005 - 02:13 PM

Quote

This version is written for my system
<snip>
I tested it and for my system it works great
If
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\cd.txt set CDROM=%%i:

:Install_drive
cls

ECHO Your CD-rom drive is: %CDROM%
then
if exist %CDROM%WINNT.SIF DEL %CDROM%WINNT.SIF
ping -n 1 127.0.0.1>nul
rem ---------------------------------------------
rem WRITE NEW ANSWER FILE
rem ---------------------------------------------
ECHO;SetupMgrTag >>%CDROM%WINNT.SIF
<snip>
You are deleting from and echoing to the optical drive, therefore how did you test it?

#13 User is offline   erik_demon 

  • Master Chief
  • PipPip
  • Group: Members
  • Posts: 253
  • Joined: 22-August 04

Posted 29 June 2005 - 03:22 PM

@Yzöwl

You have a point here, this is my misstake. I will explain it :)

My unattended structure at home is so that I am able to install from a CD, from a second harddisk and from a network share.

To not complicate things, to keep everything simpel, I work with only one variable. This variable is %CDROM%.

In my test the file called cd.txt was on my second harddrive ( D:\ ) therfore this harddrive is seen as %CDROM% and the batch file will tell you
Your CD-rom drive is: D: :D

I understand your confusion completely an when I get back from vacation (ah finally :P ) I will change it, because like you stated, it is not possible to write or delete to the optical drive.

This post has been edited by erik_demon: 29 June 2005 - 03:22 PM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy