Jump to content

define own path variables


Recommended Posts

i thought i could define my own pathvariables in the wpi.cmd like this:

set mypath = .......

but when i use it in the command x line nothing happens.

even if i used the predefined %CDROM% variable the setup files for my programs are always searched in the folder where i run the wpi.cmd file....

thats really strange because i can see that %CDROM% points to my cdromdrive in the commandline, but instead when the installation window pops up %CDROM% seems to be the path where wpi is called....

Link to comment
Share on other sites


ok sorry, just found out that i edited the WPI.ico line in the cmd file, so i just had to change the generate.js file too.....

but how do i define my own variables? just defining them in the wpi.cmd doesn't seem to be enough....

Edited by gemino
Link to comment
Share on other sites

I think the variables in WPI.cmd have nothing to do with the rest of the program. I solved this problem this way:

1) In the WPI.cmd I write the value of the variable to the registry.

2) Then in the generate.js, which is there to replace variables used in the config.js, this value is read and the variable replaced.

So here is my wpi.cmd:

@echo off&setlocal enableextensions

REM put the sharename and the application directory into variables

set share=\\mpg-bpc-s2\software$

set appdir=softwareinstall\install\englisch

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 (

fsutil fsinfo drivetype %%a:|find "No such Root Directory">nul 2>&1&&call :check %%a:

)

REM Connect the softwareshare to drvlet

net use %drvlet% %share%

REM Write the app-path to the regsitry

REG ADD HKCU\SOFTWARE\WPI /v SWPATH /t REG_EXPAND_SZ /d "%drvlet%\%Appdir%" /f

REM Determine the WPI startup path.

set wpipath=%~dp0

REM Font installation - the smooth and customizable way.

start /wait %wpipath%\Tools\fonts\fontinstaller.exe

REM Force resolution to needed size for wpi interface.

start %wpipath%\Tools\VideoChanger.exe 1024x768x32@85 -q

REM Special registry tweak needed.

regedit /s "%wpipath%\common\wpi.reg"

REM Make WPI directory the current directory.

for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:

cd "%wpipath%"

REM Start WPI and wait for its end

start /wait WPI.hta

REM Delete the Key from the registry

REG DELETE HKCU\Software\WPI /f

REM Disconnect the network drive

NET USE /DELETE %drvlet%

endlocal&goto :eof

:check

if not defined drvlet set drvlet=%1&goto :eof

------------------------------------------------------------------------------------------

To the generate.js I added the function:

function FindSWPath()

{

position = "generate.js"

swpath = WshShell.regRead("HKCU\\Software\\WPI\\SWPath");

swpath = swpath +'\\'

return swpath;

}

and to the function replpath(u) I added the following line within the other replace commands

rs = rs.replace(/%swpath%/gi, swdir);

So now in the config.js, I can use the following

prog[pn]=['Adaware 6']

uid[pn]=['ADAWARE']

desc[pn]=['Installs Adaware 6 Personal.']

cmd1[pn]=['%SWPATH%\\adaware6.exe /silent']

ordr[pn]=[505]

dflt[pn]=['no']

cat[pn]=['Antivir']

pn++

Link to comment
Share on other sites

I think the variables in WPI.cmd have nothing to do with the rest of the program. I solved this problem this way:

1) In the WPI.cmd I write the value of the variable to the registry.

2) Then in the generate.js, which is there to replace variables used in the config.js, this value is read and the variable replaced.

So here is my wpi.cmd:

@echo off&setlocal enableextensions

REM put the sharename and the application directory into variables

set share=\\mpg-bpc-s2\software$

set appdir=softwareinstall\install\englisch

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 (

fsutil fsinfo drivetype %%a:|find "No such Root Directory">nul 2>&1&&call :check %%a:

)

REM Connect the softwareshare to drvlet

net use %drvlet% %share%

REM Write the app-path to the regsitry

REG ADD HKCU\SOFTWARE\WPI /v SWPATH /t REG_EXPAND_SZ /d "%drvlet%\%Appdir%" /f

REM Determine the WPI startup path.

set wpipath=%~dp0

REM Font installation - the smooth and customizable way.

start /wait %wpipath%\Tools\fonts\fontinstaller.exe

REM Force resolution to needed size for wpi interface.

start %wpipath%\Tools\VideoChanger.exe 1024x768x32@85 -q

REM Special registry tweak needed.

regedit /s "%wpipath%\common\wpi.reg"

REM Make WPI directory the current directory.

for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:

cd "%wpipath%"

REM Start WPI and wait for its end

start /wait WPI.hta

REM Delete the Key from the registry

REG DELETE HKCU\Software\WPI /f

REM Disconnect the network drive

NET USE /DELETE %drvlet%

endlocal&goto :eof

:check

if not defined drvlet set drvlet=%1&goto :eof

------------------------------------------------------------------------------------------

To the generate.js I added the function:

function FindSWPath()

{

position = "generate.js"

swpath = WshShell.regRead("HKCU\\Software\\WPI\\SWPath");

swpath = swpath +'\\'

return swpath;

}

and to the function replpath(u) I added the following line within the other replace commands

rs = rs.replace(/%swpath%/gi, swdir);

So now in the config.js, I can use the following

prog[pn]=['Adaware 6']

uid[pn]=['ADAWARE']

desc[pn]=['Installs Adaware 6 Personal.']

cmd1[pn]=['%SWPATH%\\adaware6.exe /silent']

ordr[pn]=[505]

dflt[pn]=['no']

cat[pn]=['Antivir']

pn++

Im interested to have WPI folder in the root folder of the cd or hdd and inside wpi the folder install (applications) so it will work either from cd or hdd

is all these necessary or I can do it with more easy way

thanks

Link to comment
Share on other sites

If from CD. If you have standard

REM Example, how to look for CDROM-drive. Must have WPI.ico at the root of the CD.
for %%i 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 %%i:\wpi.ico set CDROM=%%i:
echo Found CD-Rom as drive %CDROM%

Then with %CDROM%\install\apps -> will installing from CD.

If you put %systemdrive%\install\apps -> will install from HDD partition on which are current Windows running.!

Link to comment
Share on other sites

If from CD. If you have standard

REM Example, how to look for CDROM-drive. Must have WPI.ico at the root of the CD.
for %%i 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 %%i:\wpi.ico set CDROM=%%i:
echo Found CD-Rom as drive %CDROM%

Then with %CDROM%\install\apps  -> will installing from CD.

If you put %systemdrive%\install\apps    -> will install from HDD partition on which are current Windows running.!

I know that, but I want to do the following.

I want to have the folder WPI in the root directory of my hdd or in the root dir of a cd disk, inside the wpi folder I want to have a 'install' folder which will have the applications. So in my config file I want to have a path like '\\wpi\\install\app...' so it will no matter if the drive is c: or d: or anything else. I've tried the above but WPI doesn't recognize the path.

thanks

Link to comment
Share on other sites

Perhaps try the following:

Add the following line to the WPI.cmd

REM Determine the WPI startup path.

set wpipath=%~dp0

Then in the config.js you should be able to use %WPIPATH%\Install as installation path.

I think I used this way a few months ago and it worked fine, but perhaps I forgot something right now.

Link to comment
Share on other sites

Doc Symbiosis, thanks again.

I've tried the example you gave me but WPI doesn't recognize %wpipath% in config.js.

I've tried also to copy wpi.ico in the systemdrive and use the variable %cdrom% but also no result.

Maybe I have to to use the example you gave us in the 3rd post in this topic, but I cannot understand it fully, also I don't want to use network shares.

thanks a lot

Link to comment
Share on other sites

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