Jump to content

How to install Windows from USB- WinSetupFromUSB with GUI


Recommended Posts

it's about %CDROM% variable. could you help with this?

Check this line:

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:\sources\install.wim set CDROM=%%i:

It assigns a drive letter value to the variable CDROM IF it can find the file \sources\install.wim.

It seems like this file is NOT found (and thus the drive letter is not assigned)

WHO wrote that batch?

It is seemingly missing some error control and is all in all more complex than needed.

Change this:

::@echo off
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:\sources\install.wim set CDROM=%%i:
echo Found CD-Rom as drive %CDROM%

to this:

::@echo off
SETLOCAL ENABLEEXTENSIONS
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:\sources\install.wim set CDROM=%%i:
echo Found CD-Rom as drive %CDROM%
PAUSE
IF NOT DEFINED CDROM SET /P CDROM=Enter drive letter
SET CDROM=%CDROM%:
SET CDROM=%CDROM:::=:%
SET CDROM
PAUSE

What happens?

jaclaz

Link to comment
Share on other sites


hi @jaclaz.. I'll try it now then I'll edit this post :)

my script based a tutorial from driverpacks forum.. I install updates that not integrate with DISM and regedit tweaks.

http://forum.driverpacks.net/viewtopic.php?id=5199

I play with windows 8 new.. I test my setupcomplete.cmd with windows 8 updates etc. I think there are a few lines that useless for my windows 8 that commented out.. You think that any other lines that not needed for scripts working correctly?

Link to comment
Share on other sites

@ ZEUS__

ISO is mounted as a virtual disc during PE pass using imdisk. After first restart it's not longer mounted, hence contents are not accessible, searching for install.wim or any other file on the DVD fails.

If all needed files are in that folder _ekler, you could copy it somewhere on the USB disk (\WINSETUP\ _ekler\ in this example) and amend your script to search for it, instead of \sources\install.wim.

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:\WINSETUP\_ekler set CDROM=%%i:

Alternatively, you could try mounting the ISO file again at start of your script. Not sure if imdisk can be installed and used at that phase, but maybe worth a try.

Copy WinPreSetup.exe from boot.wim, second index, or use the suitable one from WinSetupFromUSB directory\files\winsetup\ according to your version, 32 or 64 bits.

Place it somewhere on the USB disk, search for it the same way as above and launch it at start of your script passing it the path to the ISO file, e.g.:

start /wait WinPreSetup.exe /mountiso="\WINSETUP\Win8\Win8.iso"

Windows 8 also has native functionality to mount an ISO file. No clue if it's working at that stage, but could be also worth a try.

Link to comment
Share on other sites

after @ilko_t wrote, here is a new post.

@jaclaz I gave a try but nothing changed. same as before it hangs on when setupcomplete.cmd and even PAUSE didn't work.

@ilko_t, I tried with this;

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:\WINSETUP\_ekler set CDROM=%%i:

but again nothing changed. I think the key is your said about virtual disk that imdisk. the folder "_ekler" is in there but setupcomplete.cmd is in DVD :)

Edited by ZEUS__
Link to comment
Share on other sites

Where is setupcomplete.cmd exactly in your source?

Are you using OEM key? Did you use the same key in VMWare?

There is a report which says the script is not launched if an OEM key is used.

Can you check the log files for clues?

http://technet.microsoft.com/en-us/library/hh824819.aspx

Added:

When are actually contents of $OEM$ folders copied, at which phase? :unsure:

Link to comment
Share on other sites

if I boot from the iso with vmware, setupcomplete.cmd works as expected and no error etc.

with usb I boot from plop.. and issue is begin when setupcomplete.cmd.. if I deleted all lines about %CDROM% variable setupcomplete.cmd passed successfully.

here is my script;

YQKdKW3.png

I'll check some logs now.

Link to comment
Share on other sites

As I get it, setupcomplete.cmd is launched indeed, but it hangs the setup, right? I understood from your previous post that the script is not launched at all.

@ilko_t, I tried with this;

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:\WINSETUP\_ekler set CDROM=%%i:

but again nothing changed. I think the key is your said about virtual disk that imdisk. the folder "_ekler" is in there but setupcomplete.cmd is in DVD

Did you copy _ekler folder to the USB disk, in \WINSETUP\_ekler?

Link to comment
Share on other sites

@jaclaz I gave a try but nothing changed. same as before it hangs on when setupcomplete.cmd and even PAUSE didn't work.

Well, no.

Maybe the batch is launched "hidden" (and then you have to change the way it is started) but a pause is a pause, if that batch is launched and if it's command windows is visible, it will stop at the PAUSE commands.

jaclaz

Link to comment
Share on other sites

I didn't see any error in log file about hangs on.

Yes, my "_ekler" folder in "\WINSETUP\" .. I copied already.

here is my windows 7 setupcomplete.cmd.. as you see if I commented out lines with;

::IF EXIST %SystemRoot%\SysWOW64 start /wait %CDROM%\_ekler\updates\Windows-KB890830-x64-V4.16.exe /Q

script works good but when use "start /wait %CDROM%" it hangs on... but wait when I write this I realize something that if I use "start /wait %CDROM%\WINSETUP\ekler\...."... I'll try it now..

@echo off
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:\sources\install.wim set CDROM=%%i:
echo Found CD-Rom as drive %CDROM%
::Begin hotfix install


::Malicious software removal tool
::echo Installing Malicious Software Removal Tool
::IF EXIST %SystemRoot%\SysWOW64 start /wait %CDROM%\_ekler\updates\Windows-KB890830-x64-V4.16.exe /Q
::IF NOT EXIST %SystemRoot%\SysWOW64 start /wait %CDROM%\_ekler\updates\Windows-KB890830-V4.16.exe /Q


::Defender Definitions
::echo Installing Windows Defender Definition updates
::IF EXIST %SystemRoot%\SysWOW64 start /wait %CDROM%\_ekler\updates\mpas-feX64.exe /Q
::IF NOT EXIST %SystemRoot%\SysWOW64 start /wait %CDROM%\_ekler\updates\mpas-fe.exe /Q


::KB2533552
::echo Installing KB2533552 updates
::IF EXIST %SystemRoot%\SysWOW64 start /wait %CDROM%\_ekler\updates\Windows6.1-KB2533552-x64.msu /quiet /norestart
::IF NOT EXIST %SystemRoot%\SysWOW64 start /wait %CDROM%\_ekler\updates\Windows6.1-KB2533552-x86.msu /quiet /norestart


::IE) desktop icon
::echo Installing KB2533552 updates
::IF EXIST %SystemRoot%\SysWOW64 regedit.exe /s %~dp0ADD_64.reg
::IF NOT EXIST %SystemRoot%\SysWOW64 regedit.exe /s %~dp0ADD_32.reg
regedit.exe /s %~dp0reg_w7.reg
%~dp0resetwmi.exe


cd %~dp0
attrib -R -A -S -H *.*
del %~dp0reg_w7.reg
::del %~dp0ADD_64.reg
::del %~dp0ADD_32.reg
del %~dp0resetwmi.exe
SHUTDOWN /R /T 45
DEL /F /Q %0% >nul

Edited by ilko_t
Fixed codebox
Link to comment
Share on other sites

Yes, my "_ekler" folder in "\WINSETUP\" .. I copied already.

Hey, fix the paths in your script, they are all messed up.

Where is _ekler folder indeed? Under root or under WINSETUP?

This would NOT work as already mentioned, \sources\install.wim cannot be found since ISO is not mounted:

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:\sources\install.wim set CDROM=%%i:

This MAY work if you copied _ekler folder inside WINSETUP folder:

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:\WINSETUP\_ekler set CDROM=%%i:

This is wrong if _ekler folder is within WINSETUP folder:

IF EXIST %SystemRoot%\SysWOW64 start /wait %CDROM%\_ekler\updates\Windows-KB890830-x64-V4.16.exe /Q

it should be

IF EXIST %SystemRoot%\SysWOW64 start /wait %CDROM%\WINSETUP\_ekler\updates\Windows-KB890830-x64-V4.16.exe /Q

and so on.

Added: and please, easy with the fonts and colors, try to properly format your posts.

Link to comment
Share on other sites

I would like to have an option to not compress the files added by WinSetupFromUSB to my installation source for easy modification of scripts. Especially the migrate.inf and setup.cmd files and the fake setup.exe should not be compressed to make a clear distinction between original and added files.

The setup.cmd can also be reduced in size by removing obsolete code.

File modifications to winnt.sif can be reduced:


win9xupgrade="no"
winntupgrade="no"
EulaComplete="1"

These lines are not necessary for USB support.

Autopartition and MsDosInitiated should use unquoted values.

Link to comment
Share on other sites

I would like to have an option to not compress the files added by WinSetupFromUSB to my installation source for easy modification of scripts. Especially the migrate.inf and setup.cmd files and the fake setup.exe should not be compressed to make a clear distinction between original and added files.

They were compressed on purpose- on rare occasions there were reports for those files not being copied during text mode, setup complaining they were missing. Compressing them seems to have fixed the problem and I wouldn't change anything which is working fine without an important reason or finding why exactly this was happening. File sizes were not the issue I was after.

Migrate.inf is not compressed.

The setup.cmd can also be reduced in size by removing obsolete code.

Long overdue task, still ignored since focus is on much more important stuff.

File modifications to winnt.sif can be reduced:


win9xupgrade="no"
winntupgrade="no"
EulaComplete="1"

These lines are not necessary for USB support.

All these changes are there on purpose. Are there any issues with them?

Autopartition and MsDosInitiated should use unquoted values.

Care to spare more details why ?
Link to comment
Share on other sites

I would like to have an option to not compress the files added by WinSetupFromUSB to my installation source for easy modification of scripts. Especially the migrate.inf and setup.cmd files and the fake setup.exe should not be compressed to make a clear distinction between original and added files.

They were compressed on purpose- on rare occasions there were reports for those files not being copied during text mode, setup complaining they were missing. Compressing them seems to have fixed the problem and I wouldn't change anything which is working fine without an important reason or finding why exactly this was happening. File sizes were not the issue I was after.

Migrate.inf is not compressed.

The setup.cmd can also be reduced in size by removing obsolete code.

Long overdue task, still ignored since focus is on much more important stuff.

File modifications to winnt.sif can be reduced:


win9xupgrade="no"
winntupgrade="no"
EulaComplete="1"

These lines are not necessary for USB support.

All these changes are there on purpose. Are there any issues with them?

Autopartition and MsDosInitiated should use unquoted values.

Care to spare more details why ?

Normally quotes are only used to specify string values. You can save a few bytes by removing the quotes. The lines win9xupgrade="no", winntupgrade="no" and EulaComplete="1" are modifications to the answerfile which are not documented and not necessary to boot Windows setup from USB media.

Link to comment
Share on other sites

Normally quotes are only used to specify string values. You can save a few bytes by removing the quotes.

Thanks for your notes, will keep them in mind.

The lines win9xupgrade="no", winntupgrade="no" and EulaComplete="1" are modifications to the answerfile which are not documented and not necessary to boot Windows setup from USB media.

As already explained, they are there on purpose and I'd rather leave them there for now unless a serious reason for the opposite comes up.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...