Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Update your Win 7 installation media.

24 Apr 2019   #291
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

Quote:
OK, now the question:
I want to do a loop with "for"cmd
- %n% now has the number of images on install.wim
- How do I do a "for"cmd to do %wimlib% info %TP%\Wim_Files\install.wim x
where x is 1, 2, ..n

Code:
::output wimlib info for all images to screen

for /l %%a in (1,1,%n%) do %WimLib% info "%TP%\Wim_Files\install.wim" %%a

pause

::output wimlib info for all images to a text file:

for /l %%a in (1,1,%n%) do %WimLib% info "%TP%\Wim_Files\install.wim" %%a >>wiminfo.txt

::read it

notepad wiminfo.txt



My System SpecsSystem Spec
.
24 Apr 2019   #292
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

A way round that is to put the pack date in the displayname

%wimlib% info "V:\ISOx64\sources\install.wim" 1 --image-property "DISPLAYNAME=Windows 7 Home Basic %packdate%"


Update your Win 7 installation media.-displayname-packdate.jpg


My System SpecsSystem Spec
24 Apr 2019   #293
Megahertz07

Windows 7 HP 64
 
 

Quote   Quote: Originally Posted by Megahertz07 View Post
SEW2, another help.

If i do a cmd
%wimlib% info %TP%\Wim_Files\install.wim
it will list all info of install.wim

If i do a cmd
%wimlib% info %TP%\Wim_Files\install.wim 3
it will list info of image 3 of install.wim

OK, now the question:
I want to do a loop with "for"cmd
- %n% now has the number of images on install.wim
- How do I do a "for"cmd to do %wimlib% info %TP%\Wim_Files\install.wim x
where x is 1, 2, ..n

Thanks
Thanks
Rem (1,1,%n%) = start, increment, end
for /L %%A in (1,1,%n%) do (
REM --Code goes here--
)

So it would be
for /L %%A in (1,1,%n%) do (
%wimlib% info %TP%\Wim_Files\install.wim %%A
)
My System SpecsSystem Spec
.

24 Apr 2019   #294
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

You can do it on one line:

for /l %%a in (1,1,%n%) do %WimLib% info "%TP%\Wim_Files\install.wim" %%a
My System SpecsSystem Spec
24 Apr 2019   #295
Megahertz07

Windows 7 HP 64
 
 

Mega is back again.
I'm having problems with :setedn
- It does the job for HP(2) but when it comes to Pro(3) and Ultimate(4) it says that there is already a mounted image on NTempdir.
I remember this issue when I made my drivers integration on 2016. Even when you un mount an image it may say that there is still something unmounted.

- Can I do the following (I don't like &) ?
:setedn
ECHO.
setlocal DisableDelayedExpansion
start "Setting Editions Windows" /wait cmd.exe /v/c "@echo off & (for /l %%a in (2,1,%n%) do (
%DISM% /Mount-Wim /WimFile:"%TP%\Wim_Files\$install.wim" /Index:"%%a" /MountDir:"%NTempdir%"
%DISM% /Image:"%NTempdir%" /Set-Edition:!ned_%%a!
call "bin\clean7.cmd"
%DISM% /Unmount-Wim /MountDir:"%NTempdir%" /Commit
RD /S /Q %TP%\Temp 2>nul
2>nul md "Temp\Temp"
2>nul md "Temp\Temp_N"
)
)"
endlocal
My System SpecsSystem Spec
24 Apr 2019   #296
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

Or you can check for mounted images and try and cleanup beforehand.

Code:
(set ismounted=)
for /f "usebackq tokens=1,2,3 delims=:" %%G in (`%dism% /get-mountedwiminfo ^| find /i "mount"`) do set ismounted=%%I
IF NOT "%ismounted%"=="" (
	echo  Image mounted Trying cleanup
        %dism% /unmount-Wim /MountDir:"mount" /discard
	rd /s /q "mount" > nul
	%dism% /cleanup-wim 
)
Replace "mount" with "uptemp" or whatever your mount folder is.
Quote:

Even when you un mount an image it may say that there is still something unmounted.
That can happen if you have something open on the mount folder - an explorer window maybe.
My System SpecsSystem Spec
25 Apr 2019   #297
Megahertz07

Windows 7 HP 64
 
 

- It does the job for HP(2) but when it comes to Pro(3) and Ultimate(4) it says that there is already a mounted image on NTempdir.

It explain why I was having Edition ID = HOMEBASIC on PRO and Ultimate (post 264).

I will create a CleanMount.cmd and call it every time I un mount an image.

Is there any reason why you mount boot.wim and install.wim on mount folder and mount $install.wim in NTempdir folder?

Thanks.
My System SpecsSystem Spec
25 Apr 2019   #298
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

Quote:
Is there any reason why you mount boot.wim and install.wim on mount folder and mount $install.wim in NTempdir folder?
You can use whatever mount folders you like.
My System SpecsSystem Spec
25 Apr 2019   #299
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

v22F on first post.
My System SpecsSystem Spec
25 Apr 2019   #300
Megahertz07

Windows 7 HP 64
 
 

SIW2, don't know how to thank you for your patience to teach me.

At the beginning of :MountBootWim and :MountInstallWim I added this cmd line:
IF not exist %MountDir% MD %MountDir% 2>nul
and
after un mounting I added this cmd line:
If Not exist "%TP%\Temp\CleanMount.cmd" IF EXIST "bin\CleanMount.cmd" COPY /Y "bin\CleanMount.cmd" "%tp%\Temp\"
If exist "%TP%\Temp\CleanMount.cmd" CALL "%TP%\Temp\CleanMount.cmd"

CleanMount.cmd is
cd /d "%TP/Temp%"
%Dism% /unmount-Wim /MountDir:%MountDir% /discard
%DISM% /cleanup-wim
rd /s /q %MountDir% > nul
cd /d "%TP%"

:setedn
ECHO.
If Not exist "%TP%\Temp\CleanWim.cmd" IF EXIST "bin\CleanWim.cmd" COPY /Y "bin\CleanWim.cmd" "%tp%\Temp\"
If Not exist "%TP%\Temp\CleanMount.cmd" IF EXIST "bin\CleanMount.cmd" COPY /Y "bin\CleanMount.cmd" "%tp%\Temp\"

setlocal DisableDelayedExpansion
start "Setting Editions Windows" /wait cmd.exe /v/c "@echo off & (for /l %%a in (2,1,%n%) do IF not exist %MountDir% MD %MountDir% & %DISM% /Mount-Wim /WimFile:"%TP%\Wim_Files\$install.wim" /Index:"%%a" /MountDir:"%MountDir%" & %DISM% /Image:"%MountDir%" /Set-Edition:!ned_%%a! & call "Temp\CleanWim.cmd" & %DISM% /Unmount-Wim /MountDir:"%MountDir%" /Commit & Call %TP%\Temp\CleanMount)"
endlocal

Temp\CleanWim.cmd is the Clean7.cmd with SET MOUNT=%MountDir% and I use on :MountBootWim and :MountInstallWim and %MountDir%=%TP%\Temp

It's working without errors for the first time.
Thanks again.
My System SpecsSystem Spec
Reply

 Update your Win 7 installation media.




Thread Tools




Similar help and support threads
Thread Forum
TEST -Update 7 installation media
Anyone who wants to give this a try: 1. Put your win7 dvd in the drive, rt click it and select COPY. Then rt click your partition (e.g. C ) and PASTE. It will take a few mins and you should have afolder on c containing the installation files, like this: 2. Install WUD - tiny program:
Installation & Setup
Windows Media Player will not update media library
I am a music downloader. It used to be that WMP12 would update the mp3 music folders to where the folder contents would read as follows: 01 'Track Name' 02 'Track Name' 03 'Track Name' and so on... This is no longer the case. WMP will not update my media library files, although it...
General Discussion
How to get installation media?
Hi, I've got an HP Pavilion laptop that came with Windows 7 installed as a Vista upgrade. I'd like to blow it away, repartition the disk for dual boot with Linux, and do a clean install of Windows 7. The only problem (I think) is that I don't have the installation media. I've searched online...
Installation & Setup
Bad installation media I think
Remember me? I'm the one with the pirated W7 Ultimate. I finally bought a genuine W7 Ultimate disk from Newegg for the tune of $310. Still working with MasterCard to get my money back. It looks favorable. When I went to do a clean install the auto-boot worked but it hung up with a blue screen...
Installation & Setup
media smart server update corrupted media center
I have 4 computers all running windows 7-3 in 32 and 1 in 64. All were working fine and no issues with my mediasmart 470 server. I only have one computer with console running. The other day pp3 came out and has made a mess of my computer that has connector to server. It seems to have corrupted...
Media Center


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 01:55.
Twitter Facebook