Images use case
› Forums › Desktop Info › Images use case
Tagged: VHD FileBoot RamBoot Image
- This topic has 14 replies, 2 voices, and was last updated 10 months ago by
Virgus.
-
AuthorPosts
-
-
14 January, 2023 at 10:45 am #5704
Hello Glenn,
thanks for having authorized me to join the forum and thank you so much for this tool!I’ve been using BGInfo for a long time and while triying to use images I’ve read about Desktop Info which is working much better (and it’s more easy to script).
My use-case concerning images is the following:
I usually use VHDs to boot my OSs on my different PCs. In some cases I use SVBus driver to have the VHD loaded to ram prior booting. So I have three cases : 1) normal boot from a disk partition 2) file boot from a vhd 3) ram boot from a vhd loaded in ram.Since it happens that I forget the boot method used, I made a script that checks the systemdrive in diskpart and eventually gets the vhd file path from which the OS booted from or it keeps just the volume letter. According to the type of boot I created three small images that are placed inside an IF item.
What happens with the current (the latest) version of Desktop-Info is that all the images are appearing in the upper corner of the screen, then they start to move down as the items’ fields populate. When the IF items are evaluated two of the three images finally disappear. The only one remaining keeps moving down until it finds its correct location.
My wish would be to have the images hidden until the configuration file is fully evaluated, so to have possibly only the “allowed” image to be shown. Eventually making the image appear only when it’s position is correctly determined (e.g. to avoid seeing it moving on the screen).
I’m still trying to determine the best way to distinguish Ram boot from normal vhd boot, so for now the IF item just checks a file where another script writes the VHD boot path. At the moment just checking the string “.vhd” inside the %osname% text file allows me to choose between “partition boot” and “vhd boot”.
I’ll improve things when I’ll find the easiest way to check if the OS was booted from RAM. Meanwhile I’d like your opinion about this images behaviour. Maybe there are configuration settings to control the image loading process ? Or is something that might be added to the Desktop Info features wishlist ? Or maybe I could just set up a control so that the image toggles from hidden to visible so that I could hide them at first run ? What would you suggest ?
I attach you my three images and these are the lines in desktopinfo.ini
#If booted from RAM
IF=value1:%osname%, value2:.vhd, comp:notcontains
IMAGE=interval:0,text:,style:b,font-size:50%,align:1,aspect:1,width:100,file:..\IMGs\ram.png
#If booted from VHD
IF=value1:%osname%, value2:.vhd, comp:contains
IMAGE=interval:0,text:,style:b,font-size:50%,align:1,aspect:1,width:100,file:..\IMGs\vhd.png
#If booted from DISK
IF=value1:%osname%, value2:.vhd, comp:notcontains
IMAGE=interval:0,text:,style:b,font-size:50%,align:1,aspect:1,width:100,file:..\IMGs\ssd.png
#IMAGE=interval:0,text:,style:b,font-size:50%,align:1,aspect:1,width:100,file:..\IMGs\hd.pngThanks again for you excellent tool and for your time,
Virgus-
This topic was modified 11 months ago by
Virgus.
Attachments:
-
This topic was modified 11 months ago by
-
14 January, 2023 at 2:36 pm #5707
I can’t find a way to do that. In an ideal world (ie the next version) it would look like this:
BEGIN-ONLOAD
#test
set osname = .vhd
#If booted from RAM
IF=value1:%osname%, value2:.vhd, comp:notcontains
set bootimg = ram.png
#If booted from VHD
IF=value1:%osname%, value2:.vhd, comp:contains
set bootimg = VHD.png
#If booted from DISK
IF=value1:%osname%, value2:.vhd, comp:notcontains
set bootimg = SSD.png
END-ONLOAD#text=text:Boot Image,display:%bootimg%
IMAGE=width:100,file:c:\development\desktopinfo\test\%bootimg%but the IMAGE item doesn’t support variables yet ( I added it just now! )
because IMAGE doesn’t require any evaluation after load up, it’s always the first to display, before the data collector kicks in, you’ll notice this is true for the CONTROL and NAV items.
So, to force evaluation during loadup, before the data collector starts, we have the BEGIN-ONLOAD block.
TLDR: Fixed in next release using above code.
-
15 January, 2023 at 4:11 am #5708
Thank you so much for this prompt reply and solution Glenn.
I’ve been working on my script today and then found some issues related to diskpart.
In case you might be curious about it I just wrote to a forum of experienced friends, trying to find a solution http://reboot.pro/index.php?showtopic=22691It will be perfect to evaluate the correct image at load. When all the problems will be solved (those described in the previous url) I will be able to run my script from within Desktop Info during loadup (hopefully storing its results to a variable instead than writing to a file) and then getting the correct image to be displayed on the screen.
Thanks,
V. -
15 January, 2023 at 5:37 pm #5709
have you looked into whether WMI or Powershell give better results?
-
16 January, 2023 at 9:31 am #5710
I’ve been trying with powershell without success.
On two different laptops I’m not able to make a simple command as “Get-Disk Select-Object FriendlyName,Location”. I’m not sure what’s wrong in both my setups but I’d like something usable on every OS I will boot from. Diskpart works even on XP without powershell.Besides PS scripts in the WMI field I wasn’t able to find any command comparable to “Get-Disk Select-Object FriendlyName,Location”. I tried wmic diskdrive and others I found while searching but none related to vhd virtual volumes.
At the end I choosed to stick to diskpart and do what I didn’t want to do at the beginning: make a for loop to search for the correct path and get rid of the mis-match with HardDiskVolume# output from diskpart.
The script might be simplified further but for now it works with the four cases
– Normal “partition” boot
– VHD bootmgr boot (which gets also the vhd path the OS booted from)
– SVBus file boot (no clue of how to get the vhd path here)
– SVBus RAM boot12345678910111213141516171819202122232425262728293031323334353637383940414243@echo offsetlocal EnableDelayedExpansionSET BOOTLTR=%SystemDrive::=%::GET BOOTVOL# FROM %SystemDrive::=%for /f "tokens=2" %%a in ('^(echo list volume^) ^| diskpart ^| findstr /i /r /c:".* %BOOTLTR% .*" ') do SET BOOTVOL=%%a::GET BOOTDISK# FROM %BOOTVOL%for /f "tokens=3" %%a in ('^(echo select volume %BOOTVOL% ^& echo detail volume^) ^| diskpart ^| findstr /i /r /c:" Disk [^#]" ') do SET BOOTDISK=%%a::GET BOOTDEV FROM %BOOTDISK%for /f "tokens=*" %%a in ('^(echo select disk %BOOTDISK% ^& echo detail disk^) ^| diskpart ^| findstr /i /r /c:".* Device$" /c:".* Virtual .*" /c:".*GB$" ') do SET BOOTDEV=%%aIF "%BOOTDEV%" EQU "" SET BOOTDEV=UnknownBootDeviceSET BOOTTYPE=%SystemRoot% - Disk %BOOTDISK%, Volume %BOOTVOL%:: SVBus Boot Device CasesIF "%BOOTDEV:SVBus=%" NEQ "%BOOTDEV%" (SET BOOTTYPE=SVBus FileBootIF "%BOOTDEV:RAM=%" NEQ "%BOOTDEV%" SET BOOTTYPE=SVBus RamBoot):: Bootmgr Boot CaseIF "%BOOTDEV:Virtual=%" NEQ "%BOOTDEV%" IF "%BOOTDEV:SVBus=%" EQU "%BOOTDEV%" (for /f "tokens=*" %%a in ('^(echo list vdisk^) ^| diskpart ^| findstr /i /r /c:" Disk %BOOTDISK%"') do SET output=%%afor /f "tokens=2 delims=\" %%c in ('echo !output!') do SET Device=%%c& ECHO !Device!for /f "tokens=3 delims=\" %%c in ('echo !output!') do SET VhdSrcVol=%%c& SET VhdSrcVol=!VhdSrcVol:HarddiskVolume=!& ECHO !VhdSrcVol!for /f "tokens=3,* delims=\" %%c in ('echo !output!') do SET VhdSrcPath=%%d& ECHO !VhdSrcPath!IF !Device!==Device (for /f "tokens=3" %%e in ('^(echo list volume^) ^| diskpart ^| findstr /i /r /c:"Volume !VhdSrcVol!" ') do SET VhdSrcRoot=%%e& ECHO VHD Source Root is !VhdSrcRoot!SET BOOTTYPE=!VhdSrcRoot!:\!VhdSrcPath!)IF NOT EXIST "!BOOTTYPE!" (SET BOOTTYPE=^?:\!VhdSrcPath!FOR %%G IN (A B 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 "%%G:\!VhdSrcPath!" SET "BOOTTYPE=%%G:\!VhdSrcPath!"&&GOTO :END)):ENDCLSECHO Boot is from !BOOTTYPE! & PAUSEWhen the next Desktop Info will be released I’ll try to run the script from inside D.I. so to avoid the need of writing to an external file.
I’ll drop here a line if I’ll find a better solution: there’s still the case that with two VHDs with the same name, placed in the same path on two different partitions, the script chooses the wrong one. But it would happen only when doing backups or disc cloning so it should happen quite rarely.
-
16 January, 2023 at 10:06 am #5711
BTW, thinking about differencing disks: I use two different naming methods. The easier one is just adding _diff# to the VHD base name and would be very easy to parse in Desktop Info. The second one is made by adding a capital letter and a progressive number to every child (never had to use more than two levels actually but in theory they could more). This second method would be easy to be parsed via regular expressions.
I’ve used regex calls in desktopinfo.ini on items’ return values but how difficult would it be to introduce regexp evaluation in IF item conditions also ?
V.
-
16 January, 2023 at 11:45 am #5712
if the IF item is working on variables set from other items then it “should work”.
-
-
26 January, 2023 at 10:12 am #5748
Dear Glenn,
thanks for the latest release. I’m trying to make my configuration work but I didn’t succeed yet. May I ask your advice ?First of all this is the new script I wrote you about https://file.io/U0iGxaZScX1p
The possible three outputs (for now) are: “Boot src: <Path to the VHD file>”, “Boot src: SVBus FileBoot”, “Boot src: SVBus RamBoot”That said I tried to run it as an item and it works correctly
123[items]CMD=file:cmd.exe,parameters:/c ..\DPboot.bat,text:,set:bootsrc=%4,hidden:1COMMENT=interval:0,text:,style:b,font-size:50%,color:afafaf,hide-no-result:1,display:%bootsrc%Then I tried to run it at load time, so that I could use the new features you just implemented:
123456#BEGIN-ONLOADCMD=file:cmd.exe,parameters:/c ..\DPboot.bat,text:,set:bootsrc=%4,hidden:1#END-ONLOAD[items]COMMENT=interval:0,text:,style:b,font-size:50%,color:afafaf,hide-no-result:1,display:%bootsrc%But this time it didn’t work.
Besides this detail, I tried using the variables assignments like you showed me a few days ago. I couldn’t make it work in the onload section, so I tested it inside the items section. Like so:
1234567891011121314[items]CMD=file:cmd.exe,parameters:/c ..\DPboot.bat,text:,set:bootsrc=%4,hidden:1COMMENT=interval:0,text:,style:b,font-size:50%,color:afafaf,hide-no-result:1,display:%bootsrc%IF=value1:%bootsrc%, value2:vhd, comp:containsset bootimg=..\IMGs\vhd.pngIF=value1:%bootsrc%, value2:RamBoot, comp:containsset bootimg=..\IMGs\ram.pngIF=value1:%bootsrc%, value2:FileBoot, comp:containsset bootimg=..\IMGs\ssd.pngIMAGE=interval:0,text:,align:1,aspect:1,width:100,file:%bootimg%In this case I’m always getting the last %bootimg% assignment.
It appears as whenever the IF statement is not true the following line is taken into account
In my case the script’s output assigned to %bootsrc% is “Boot src: D:\VHDsBtWin\NuOS\20190410_AsusU30i7_diff.vhd”
Maybe this behaviour it is due to the variable’s content ?May I ask you to give a look to these settings please ?
The optimum desktopinfo.ini at the end should be the following:
12345678910111213#BEGIN-ONLOADCMD=file:cmd.exe,parameters:/c ..\DPboot.bat,text:,set:bootsrc=%4,hidden:1IF=value1:%bootsrc%, value2:vhd, comp:containsset bootimg=..\IMGs\vhd.pngIF=value1:%bootsrc%, value2:RamBoot, comp:containsset bootimg=..\IMGs\ram.pngIF=value1:%bootsrc%, value2:FileBoot, comp:containsset bootimg=..\IMGs\ssd.png#END-ONLOAD[items]COMMENT=interval:0,text:,style:b,font-size:50%,color:afafaf,hide-no-result:1,display:%bootsrc%IMAGE=interval:0,text:,align:1,aspect:1,width:100,file:%bootimg%Thanks again for all your support,
Virgus -
30 January, 2023 at 3:29 pm #5752
You need to put everything in the [items] section.
Firstly, get it working *without* the BEGIN-ONLOAD / END-ONLOAD lines. To properly debug, add “hidden:0” to every single line so you can follow the logic. Add a line at the top to set the initial default value in the event that all IF items return false.
I added a SET item so I can test your CMD result. This is a useful method for testing just the IF items.
INI123456789101112131415161718192021222324[items]# initial default valueset bootimg = <none>, hidden:0# get the boot sourceCMD=file:cmd.exe,parameters:/c DPboot.bat,text:,set:bootsrc=%4,hidden:0, wide:1# Glenn test with hard coded variableset bootsrc = D:\VHDsBtWin\NuOS\20190410_AsusU30i7_diff.vhd, hidden:0# test for VHDIF=value1:%bootsrc%, value2:vhd, comp:contains, hidden:0set bootimg=..\IMGs\vhd.png, hidden:0# test for RAMIF=value1:%bootsrc%, value2:RamBoot, comp:contains, hidden:0set bootimg=..\IMGs\ram.png, hidden:0# test for SSDIF=value1:%bootsrc%, value2:FileBoot, comp:contains, hidden:0set bootimg=..\IMGs\ssd.png, hidden:0# Glenn test the image variableTEXT=text:Boot Image, display: %bootimg%IMAGE=interval:0,text:,align:1,aspect:1,width:100,file:%bootimg%at this point you should see output for every line and see what it’s up to. Once you’re happy the IF items are working, remove the test items and put the ONLOAD lines in place.
INI123456789101112131415161718192021222324252627282930[items]BEGIN-ONLOAD# initial default valueset bootimg = <none>, hidden:0# get the boot sourceCMD=file:cmd.exe,parameters:/c DPboot.bat,text:,set:bootsrc=%4,hidden:0, wide:1# Glenn test with hard coded variable# set bootsrc = D:\VHDsBtWin\NuOS\20190410_AsusU30i7_diff.vhd, hidden:0# test for VHDIF=value1:%bootsrc%, value2:vhd, comp:contains, hidden:0set bootimg=..\IMGs\vhd.png, hidden:0# test for RAMIF=value1:%bootsrc%, value2:RamBoot, comp:contains, hidden:0set bootimg=..\IMGs\ram.png, hidden:0# test for SSDIF=value1:%bootsrc%, value2:FileBoot, comp:contains, hidden:0set bootimg=..\IMGs\ssd.png, hidden:0END-ONLOAD# Glenn test the image variable#TEXT=text:Boot Image, display: %bootimg%IMAGE=interval:0,text:,align:1,aspect:1,width:100,file:%bootimg%# ... the rest of the items ... -
30 January, 2023 at 11:41 pm #5754
Thank you so much Glenn,
putting everything to hidden:0 is very useful debugging mode.Actually all the IFs are evaluated correctly but unexpectedly the %bootimg% assignment is always the last one of the ini file, despite de result of the IF.
Please find here the three tests I made: https://ibb.co/album/7kYMsr
– 1st your example as it is
– 2nd I just wanted to test how it worked by putting the set command inside the IF statement and the set is always executed.
– 3rd a variation of the 1st, with IMAGE interval:1 to try to update the image after the variable’s assigment.It seems that the IMAGE is still evaluated too early, and that subsequent assignments are not taken into account.
Talk to you soon,
Virgus.BTW FYI I tried to listen to your music samples and I couldn’t listen to those track that are not on SoundCloud (e.g glenn-delahoy-gimme-dem-blues-1989). Tried with both chrome based browsers and ff based ones.
-
31 January, 2023 at 9:17 am #5755
You are correct in that, without the ONLOAD, the IMAGE and SET items will load before the IFs have evaluated. The IMAGE doesn’t get any second chances (I must fix that). Notice the final TEXT displays the correct value for %bootimg%
Now put the ONLOAD lines in place to force the CMD and IF items to evaluate before anything else.
-
31 January, 2023 at 10:08 am #5756
thanks for the heads up on the music samples. all fixed.
-
-
1 February, 2023 at 1:02 am #5757
It’s working !
My bad: I was putting BEGIN-ONLOAD/END-ONLOAD block before the [items] section !
Thanks for your patience and support, Glenn.I extended my script with the Grub4Dos info and everything seems to work correctly both on W7 and W10. I’ll test XP soon I hope, but there will be less info available (as VHD support is not as extended as on Vista and later OSs).
BTW I’m adding the differencing disks icon to the list and I’ve the regex pattern that I’m using in my batch script:
123456@ECHO offSET "bootsrc=D:\VHDsBtWin\NuOS\20190410_AsusU30i7_dA1.vhd"::SET "bootsrc=D:\VHDsBtWin\NuOS\20190410_AsusU30i7_diff.vhd"FOR /F %%i IN ('echo %bootsrc% ^| FINDSTR /rc:"_d[a-Z][1-9].vhd" /irc:"_diff.vhd"') DO ECHO %%iPAUSEAs an alternative to what I was trying to do in the desktopinfo.ini:
123# test for DIFFIF=value1:%bootsrc%, value2:dif, comp:contains, regex:d[A-Z][1-9], hidden:0set bootimg=..\IMGs\dif.png, hidden:0I’ll be curious to have your opinion on how this kind of use might be achieved but for now I’ll stick with the findstr option and add a “diff” string to the output of my script. I suppose that using the regex option from Desktop Info would be harder to handle overall.
Thanks again and have a nice day,
V.-
This reply was modified 10 months ago by
Virgus.
-
3 February, 2023 at 7:03 am #5761
what is the regex supposed to be doing?
-
This reply was modified 10 months ago by
-
8 February, 2023 at 7:59 am #5768
Hello Glenn, sorry for the late reply.
I was trying to check for patterns like _dA1 where _d might indicate the fact that the vhd is a differencing disk, provided that is followed by a capital letter and a number from 1 to 9. This could be an extension of writing just “_diff” in the vhd’s name. Useful when using many differencing disks and with more than one child, both for testing purposes and for everyday use (via G4D particularly because you can just edit a txt file instead of having to write to the bcd file).
BTW G4D does not support differencing disks natively but it can handle them with “extensions” like NTBoot or NTloader.
-
This reply was modified 10 months ago by
Virgus.
-
This reply was modified 10 months ago by
-
-
AuthorPosts
- You must be logged in to reply to this topic.