Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

RunOnceEx from CD tip

Featured Replies

Hi! I read through articles at msfn.org (btw GREAT work).

I am working as deployment consultant and I think I could help/improve few things... For example RunOnceEx from CD - U dont need to search cd.txt, U can use WMI (WMIC) to find the cd drive... For example this "script" will make the job:

wmic cdrom where "VolumeName='0006'" get drive /value > temp.txt

FOR /F "usebackq tokens=2 delims==" %i IN (`type temp.txt`) DO echo %i > temp.txt

set /p test1= < temp.txt

OK, I found further reading about WMI HERE, but I'm not a programmer. Can you provide a real-life example of how this script would be implemented to initialize RunOnceEX from CD? Real tutorial-type leg bone connected to the hip bone stuff for dumb-dumb heads. :w00t:

  • Author

Wmic is EXTREMELY powerfull command-line utility, that provides access to WMI classes without knowing about programming. I made presentation about it for Microsoft few weeks ago :)

So this is script to find the letter of cddrive, where boot cd is inside...

wmic cdrom where "VolumeName='XPSP2'" get drive /value > cddrive.txt

this command will find the cdrom drive, where is media named XPSP2. Then it will same the drive letter to file cddrive.txt (it will looks like Drive=D:)

FOR /F "usebackq tokens=2 delims==" %i IN (`type cddrive.txt`) DO echo %i > drive.txt

This line will open the file, pick up X: part and save it to same file again.

set /p cddrive= < cddrive.txt

this last drive will input the cddrive letter do variable cddrive...

for %%a 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 %%a:\WIN51 set CDROM=%%a:

Here is plain batch, without the need to make a temp file.

I preffer MHz method. It works great in Win2K, WinXP and the code is reusable with all my versions since I am looking for CD.bin which is present on all of my CD.

The method you suggested is checking for the CD label which is different on every CD.

I like it when my Unattended OS are updated the same way. One less thing to worry about. I can copy/paste my code from one another without having to care about fancy details

@Soulin

Bit hit and miss asking it for a Vol descriptor! Surely better to look for the ident file which should be omni-present.

Look this Thread

This not only gets CD letter but ejects CD then loads it checks for correct CD and runs specified command from CD.

Any questions?

  • 5 months later...

Hello,

Yesterday I've found a new way to determine the cdrom drive letter during installation. It's quite simple and less typing. Replace in the RunOnceEx.cmd (or any other batchfile) the following:

for %%a 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 %%a:\WIN51 set CDROM=%%a:

with

set CDROM=%~d0

Now a little explanation for "%~d0"

%0 (zero) is a variable which contains the filename being executed. With the "~ + a letter" you can retrieve several details about the executed file and ~d will retrieve the drive letter. Since RunOnceEx.cmd in on the CD, it returns your cdrom driveletter (assigned during installation).

Here is a little batchfile to show you what you can do with it:

@echo off
echo This script will show several (hopefully) interresting things of the
echo variable %%0
echo.
echo Command executed         (%%0)  : %0
echo Directories              (%%~p0): %~p0
echo Drive                    (%%~d0): %~d0
echo Filename (no ext.)       (%%~n0): %~n0
echo Extension                (%%~x0): %~x0
echo Full path + filename     (%%~f0): %~f0
echo Modification time (file) (%%~t0): %~t0
echo Filesize                 (%%~t0): %~t0
pause

Put this in a batchfile and execute it. copy/move it to another directory (and/or drive) to see how it's effect. rename it and execute it again. This method cannot determine you cdrom driveletter when the batchfile is not stored on you CD. More info can be found in the help of the FOR command (for /?)

It works on Win XP (Pro). I don't know about other OS'es.

I hope you can do something with it.

Sorry

the line:

echo Filesize                 (%%~t0): %~t0

should be:

echo Filesize                 (%%~z0): %~z0

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.