Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

CDROM variable

- - - - -

  • Please log in to reply
27 replies to this topic

#1
leungda

leungda

    Junior

  • Member
  • Pip
  • 51 posts
I just want to know the CDROM variable for WinXP unattended on RunOnceEx.cmd

Is it - > %CDROM% or %CDDRIVE% ????

If I have one or more CDROM or partition, Is the system find the CDROM "with installation CD" automatically?

If not , how can I let the system know where is the CDROM "with installation CD in it" ???


How to remove advertisement from MSFN

#2
MCT

MCT

    MSFN Junkie

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,291 posts
  • OS:none specified
  • Country: Country Flag
IF EXIST C:\somefile.whatever set CDROM=C:
IF EXIST D:\somefile.whatever set CDROM=D:
keep goin 2 the end of the alphabet :P
IF EXIST Z:\somefile.whatever set CDROM=Z:
Posted Image Posted Image
Windows 7 32Bit 2GB Ram 120GB HDD (Laptop), Windows 8 4GB Ram 1TB HDD (Desktop) Windows XP SP3 VM with enhancements!

#3
leungda

leungda

    Junior

  • Member
  • Pip
  • 51 posts
thanks for your help... :P

#4
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 5,399 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Why everybody seems to insist on doing it this way is beyond me (almost all post about their CDRom var seem to be like that anyways)

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:\path\to\file.xyz set CDROM=%%a:
Works for all letters. One clean command line.
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#5
SiMoNsAyS

SiMoNsAyS

    C'mon you apes! You wanna live forever!?

  • Patrons
  • 3,455 posts
i personally use

FOR %%d 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 %%d\CD.TXT SET CDROM=%%d

what it's marked in red can be changed to any singular file that you would like to use.
what it's marked in green can be changed to call the cdrom like %CDROM% or %ANYSTRING%. hope it hleps :lol:

edit: f***! another time some1 is faster :realmad: :lol:

Edited by SiMoNsAyS, 18 October 2004 - 08:05 AM.


#6
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 5,399 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Same thing than I do, just with more : 's ;) (oh, and %%d verus %%a) Works nicely :)

(Sorry for being a few seconds faster lol)
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#7
drixomanbeta

drixomanbeta

    Newbie

  • Member
  • 22 posts
  • OS:XP Pro x86
  • Country: Country Flag
Hi,

before I say anything, yes I know this seem to have been asked multiple time but bear with me. I'm a definite newb at this...

anyway...I've found this little code that I think would satisfy navigating to the installation source directory with the GUIRunOnce in winnt.sif (I have no doubt this look very familiar to you experts on here)

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:\yourfile.xyz set CDROM=%%a

I thought, why couldn't I just call cmd.exe from GUIRunOnce, passing the above statement (which would normally be ran in a separate batch file) as a parameter (or "echo" it into the prompt and ran, if that's pretty much the same thing...) instead of putting that in a separate file having to be copied from $OEM$ folder.

Any idea how to do this? I must admit I have NO skill with the command prompt at all that can be even close to help here....

Thanks.

#8
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,527 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

SET will not set a variable beyond the current session so you cannot simply set a variable which can be used in future command sessions. Each line you create under GUIRunOnce will be a different command session. If you wish to work directly from GUIRunOnce, you'd have to do it all in one single line of commands concatenated as required.

#9
drixomanbeta

drixomanbeta

    Newbie

  • Member
  • 22 posts
  • OS:XP Pro x86
  • Country: Country Flag
Well...I was just thinking to use it to call on one batch file only on my disc. I'm not planning to run all my command with just one long concatenate by calling on cmd at RunOnce.

#10
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,527 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

If you create a directory, SCRIPTS, in for instance, YourCD:\SUPPORT\TOOLS you can place MyScript.cmd inside it and run something like this from winnt.sif:
[GuiRunOnce]
	DetachedProgram = CMD.EXE
	Arguments = "/Q /C FOR /F %# IN ('%SYSTEMROOT%\SYSTEM32\MOUNTVOL.EXE^|FINDSTR [C-Z]:\\') DO IF EXIST %#WIN51 CALL %#SUPPORT\TOOLS\SCRIPTS\MyScript.cmd"
The above is three lines in total.

That should run the script from your CDROM meaning that all commands within that script can be designed to be local to the CDROM e.g. %~d0

#11
drixomanbeta

drixomanbeta

    Newbie

  • Member
  • 22 posts
  • OS:XP Pro x86
  • Country: Country Flag
Hi, sorry for being a little late...

I tried your code above but it doesn't seem to be able to find the file that my batch file is suppose to start.

I first tried it in installation, then I just tried it in plain Windows with a Run dialog with the following

%SYSTEMROOT%\SYSTEM32\cmd.exe /Q /C FOR /F %# IN ('%SYSTEMROOT%\SYSTEM32\MOUNTVOL.EXE^|FINDSTR [C-Z]:\\') DO IF EXIST %#WIN51 CALL %#PostInstall.cmd

The master batch PostInstall is at the root of CD, and it's suppose to "START /wait" a couple of program:

the line in the batch program is : Start /wait UPDATE\3whateverprogram\whateverprogram.exe /parameter

Both pretty much give the same result of not finding what the Start command is suppose to find. Simply running the batch file from the cd's root has no such problem.

Any idea how to fix this?

Thanks

#12
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,527 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Can you provide a directory listing? Type the following into a command prompt and copy/paste the output into your response.
for %# in (%systemdrive% X:) do @(echo/---%#---&dir/b/a/og %#)
Replace X with the drive letter for your inserted unattended media

#13
drixomanbeta

drixomanbeta

    Newbie

  • Member
  • 22 posts
  • OS:XP Pro x86
  • Country: Country Flag
I skipped the Systemdrive part, was that required?

---G:---
$OEM$
VALUEADD
UPDATE
DOCS
I386
SUPPORT
cmpnents
PostInstall.cmd
Last Session_u.ini
SETUP.EXE
Last Session.ini
BOOTFONT.BIN
AUTORUN.INF
WIN51
WIN51IP
README.HTM
setupxp.htm
win51ip.SP2
win51ip.SP3

Sorry for some editing there, I moved my batch file into a folder later on but still the same problem. I now moved it back.

Edited by drixomanbeta, 07 February 2012 - 08:53 PM.


#14
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,527 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Now the exact contents, (no editing), of your PostInstall.cmd.

#15
drixomanbeta

drixomanbeta

    Newbie

  • Member
  • 22 posts
  • OS:XP Pro x86
  • Country: Country Flag
Here's the batch file:

CLS
@echo off
TITLE Post Install

ECHO Installing KB
ECHO Please Wait...

start /wait UPDATE\977816\update\update.exe /norestart /passive /nobackup
start /wait UPDATE\n2656353.msp  /norestart /passive 
(there's other stuff in the same format as above here)

EXIT


#16
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,527 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

What happens if you change the content of PostInstall.cmd temporarily to:
@ECHO OFF
TITLE Testing Script
ECHO=%%CDROM%%=%~d0
ECHO=Delaying tactics employed
PING -n 11 127.0.0.1 1>NUL

BTW, which part of exact contents and no editing did you not understand?

#17
drixomanbeta

drixomanbeta

    Newbie

  • Member
  • 22 posts
  • OS:XP Pro x86
  • Country: Country Flag
Oh sorry about that. It's just that I have the same line repeated many time with different program in different folders. You can ignore that bracketed line.

Do you want me to change the batch to what you provided there and call it with the Run dialog with the parameter you provided earlier?

#18
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,527 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Yes, but run it from a command prompt not the run box.
FOR /F %# IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO IF EXIST %#PostInstall.cmd CALL %#PostInstall.cmd

recreate the original set-up, replacing only the content of the batch file. This should isolate the problem area to either your batch file or the implementation of the set-up.

#19
drixomanbeta

drixomanbeta

    Newbie

  • Member
  • 22 posts
  • OS:XP Pro x86
  • Country: Country Flag

Yes, but run it from a command prompt not the run box.

FOR /F %# IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO IF EXIST %#PostInstall.cmd CALL %#PostInstall.cmd

recreate the original set-up, replacing only the content of the batch file. This should isolate the problem area to either your batch file or the implementation of the set-up.


okay...I replaced my batch with your ping test and ran the for loop from a prompt. Here's what happens:

D:\Documents and Settings\Drix>IF EXIST C:\PostInstall.cmd CALL C:\PostInstall.c
md

D:\Documents and Settings\Drix>IF EXIST D:\PostInstall.cmd CALL D:\PostInstall.c
md

D:\Documents and Settings\Drix>IF EXIST E:\PostInstall.cmd CALL E:\PostInstall.c
md

D:\Documents and Settings\Drix>IF EXIST G:\PostInstall.cmd CALL G:\PostInstall.c
md
%CDROM%=G:
Delaying tactics employed


From there it just exit and return to the prompt. My (virtual) disc drive is G: (Daemon Tools Lite)
Just my opinion but I don't think there's anything wrong with my batch file, seeing that it works no problem if it's just dbl-clicked on (even as burned to CD, so it's probably not related to batch and the set-up's file structure).

#20
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,527 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

The command I gave you which runs the batch file is seen to have worked and the batch content I provided is seen to have worked.

Since the folder structure you provided contains the tag file required I can see only two likely problems, your winnt.sif or your PostInstall.cmd. If you are convinced that your batch script, (the content of which you have hidden from us), is okay then your issue is with the .sif file. However since you reported the script not running from my command earlier, and your folder structure clearly shows it should with a working command line, I am not ruling out the script as the most likely problem.

In order to find a solution, attach both files exactly as they are to be examined, otherwise you are on your own.

#21
drixomanbeta

drixomanbeta

    Newbie

  • Member
  • 22 posts
  • OS:XP Pro x86
  • Country: Country Flag
I have posted my batch file earlier, could you not see it?

I'm pretty sure my batch (should) have no problem, seeing that if you just run it normally from explorer all the start commands works, as the target program are all called as relative path.

It's just that when it is called by your parameter it seems to have lost track of its "starting location" or something. I wouldn't think we need to examine the sif file as even not in installation mode I'm unable to get my batch to perform as it should with your command there, so it's doubtful that it's an installation issue.
But here's the two file you requested: I changed the sif to have it run at T-9 instead of GuiRunOnce, but that shouldn't matter since the same problem of my batch not finding directory structure correctly persist. The problem it seems is rather fundamental and I'm not expecting it to change with different timing of the call to the batch.

Attached Files



#22
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,527 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

I gave you the entries for GuiRunOnce as requested but you decided to go it alone, so you have your wish!

#23
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,796 posts
  • OS:none specified
  • Country: Country Flag
@drixomanbeta -

I counted at least five times in this thread where Yzöwl asked you to do or report something specific, and you decided to do or report something different, always saying "but that shouldn't matter...". Yzöwl has decided, since you obviously feel you know what should or shouldn't be done, that you must not need any help, and I think everyone else here agrees with him. We will be curious to learn what you eventually find to be the problem Who knows? We might learn something.

In the future, if you ask someone to help, and they graciously offer to give you advice, here or elsewhere:

First - Take it. Do not edit it, do not change it, do not question it, do not try a shortcut, do not ask why, do not think, just do it and report exactly what happened. There are usually good reasons why you are being asked to do or report something specific.

Then - Propose alternatives, ask questions, show what happens when you do it a different way. In the exchange of data, in both directions, we can both learn something. But if you won't listen to us, then why should we listen to you?

Please let us know when you find a solution.

Cheers and Regards

Posted Image


#24
drixomanbeta

drixomanbeta

    Newbie

  • Member
  • 22 posts
  • OS:XP Pro x86
  • Country: Country Flag
In fact I did found the problem, and the solution. You wouldn't (would you?) believe how simple it was...(and how dumb I was.) :blink:

The problem: in my batch file I kept relative path when I should have used full, like so: start /wait %~d0\UPDATE\... Problem solved.

Apparently it did not occur to the unenlightened me of what y'all here would probably have thought of as 1+1

Then again, when I said I was a newb, I really did meant it. How come this batch worked when ran on its own while called on by prompt it fails? Anyway...

To that end...I still don't understand how %~d0 actually work (yes I searched for it...something about %n special enviro variable...way out of my league to comprehend :( )

Anyway, thanks for the help here; consider my question answered. At least if some other simpleton like me asked these silly type of question...well they won't have to torment you experts for too much with this particular case. (I probably should have sticked to svcpack rather than setupparams. I obviously don't know the difference (except I know I have some other stuff from addonpacks being called at T-13; don't want to mess up that). :hello:

"I'm a simple man. I do not possess a [compsci] degree nor am I [algorithmically] inclined." ~George Carlin. :blushing:

#25
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,527 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

In fact I did found the problem, and the solution. You wouldn't (would you?) believe how simple it was...(and how dumb I was.) :blink:

The problem: in my batch file I kept relative path when I should have used full, like so: start /wait %~d0\UPDATE\... Problem solved.

I had already told you to do that too! :whistle:

That should run the script from your CDROM meaning that all commands within that script can be designed to be local to the CDROM e.g. %~d0


Thanks for posting back and for providing closure to the problem, it means that other readers with the same or similar problem can use the advice given in the knowledge that it is known to work!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN