Jump to content

Recommended Posts

Posted

Hiya.

In my RunOnceEx.cmd file (which we all know what is about, right?) I have these lines:

REG ADD %KEY%\010 /VE /D "Microsoft Office" /f

REG ADD %KEY%\010 /V 1 /D "%CDROM%\Applications\OfficeXP\Setup.exe TRANSFORMS=Unattended.MST /qb-" /f

ECHO @echo off > %windir%\install.cmd

ECHO CMDOW @ /HID >> %windir%\install.cmd

ECHO %CDROM% >> %windir%\install.cmd

ECHO cd \Applications\Proof >> %windir%\install.cmd

ECHO Setup.exe >> %windir%\install.cmd

ECHO exit >> %windir%\install.cmd

REG ADD %KEY%\010 /V 2 /D " %windir%\install.cmd" /f

now, my question is... why does this last command there end up opening the root of my C: drive and not run Setup.exe like I tell it to? This is so bizarre to me that I cannot figure it out.


Posted

put 2 more " around the ""

the first "u have is for the reg entry and second u're going to put is for the command prompt to get the whole line..

Posted

*cough* -- wait a minute.. I just discovered something. It might not be important, but still... I have a space, right here:

REG ADD %KEY%\010 /V 2 /D " %windir%\install.cmd" /f

after the first quote, see? That might be a problem. I don't know for sure though. :)

Guest zippy
Posted

ECHO %CDROM% >> %windir%\install.cmd
ECHO cd \Applications\Proof >> %windir%\install.cmd

try make it like...

ECHO CD /D %CDROM%\Applications\Proof >> %windir%\install.cmd

sometimes i got trouble on change drive using %CDROM% on cmd file...

Posted

You mean this part?

ECHO @echo off > %windir%\install.cmd
ECHO CMDOW @ /HID >> %windir%\install.cmd
ECHO %CDROM% >> %windir%\install.cmd
ECHO cd \Applications\Proof >> %windir%\install.cmd
ECHO Setup.exe >> %windir%\install.cmd
ECHO exit >> %windir%\install.cmd

REG ADD %KEY%\010 /V 2 /D "%windir%\install.cmd" /f

The ECHO lines actually make a cmd file that is like this:

@echo off
CMDOW @ /HID
D: (or whatever the %CDROM% variable is when it is applied)
cd \Applications\Proof
Setup.exe
exit

I do this because the AutoIt script that I use to install that stuff automatically requires to be in the same folder as the actual files.. for some reason. And since %CDROM% can change, so must the install.cmd

Oh yeah, btw, it solved once I removed that space from the beginning of the command. :)

Posted

yes that part - thanks, but why couldn't you just use set the %CDROM% variable in the install.cmd file too?

so it would look like this:

@echo off
CMDOW @ /HID
IF EXIST D:\CD.id set CDROM=D:
IF EXIST E:\CD.id set CDROM=E:
IF EXIST F:\CD.id set CDROM=F:
%CDROM%\Applications\Proof\Setup.exe
exit

and if that is all that is really needed why do all the CD (change directory) stuff?

Posted

Well, the %CDROM% would most likely not change to the next boot, and your idea wouldn't work, cause it has to be IN the same directory as the actual program to work. So if you do "%CDROM%\Applications\Proof\Setup.exe" then it won't work, cause it will run from %windir%. (or at least I assume so, since install.cmd is in %windir%) That is what the CD is for, to change to the same directory as the Setup.exe file.

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...