Jump to content

Recommended Posts

Posted

I know, the topic title is a bit wierd in this forum, but:

I just changed all my batchfiles so that i use only .js-files and XPlode. The problem i have now, is this: I run all the installations from the cd, but to succesfull run a few installations, i made a .js wrapper around it. these .js-files run the actual installer. in those .js files are still paths to %systemroot%. what variabele do i have to use, so that it will look in the correct folder on the cd.

(i already posted this in the xplode forum part, but i just reported that post, as i think it doesn't belong there)


Posted

I'm going to answer my own question again. Just put this at the top of any .js-file to let it see your cdrom.

thisDrive = WScript.ScriptFullName;
thisDrive = thisDrive.substr(0,3);

the variable thisDrive wil contain something like "d:\" then use it like thisDrive + "the rest of the path"

Posted

This is what I use:

var WshShell = WScript.CreateObject ("WScript.Shell");

var path = WScript.ScriptFullName;//getting the path to this script

var CDROM = path.substring(0,2);//extracting (DriveLetter:) from the path

WshShell.RUN (CDROM + "\\Install\\Winamp\\winamp.exe");//running exe

WScript.Sleep(3000);//time needed by installer to extract its files

WshShell.AppActivate("Winamp Setup");//name of setup screen

No matter where your JS is, it will read the first two letters, i.e. C:, D:, and so on.

No matter your JS is on HD or CD. I mean, you no longer need to use %systemdrive% if you install from your HD, either.

Posted

These are the one I use:

Shell = WScript.CreateObject("WScript.Shell");
Environnement_system = Shell.Environment("SYSTEM");
Environnement_process = Shell.Environment("PROCESS");
Network = WScript.CreateObject("WScript.Network");

windir = Environnement_process("SYSTEMROOT")
systemdrive = Environnement_process("SYSTEMDRIVE");
ProgramFiles = Shell.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ProgramFilesDir");
SourcePath = Shell.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\SourcePath");

UserProfile = Environnement_process("USERPROFILE");
UserProfileTous = Environnement_process("ALLUSERSPROFILE");

DefaultUserProfile = systemdrive + "\\Documents and Settings\\Default User\\";

QuickLaunch = UserProfile + "\\Application Data\\Microsoft\\Internet Explorer\\Quick Launch\\";
MenuDemarrer = UserProfile + "\\Menu Démarrer\\Programmes\\";
Bureau = UserProfile + "\\Bureau\\";
QuickLaunchTous = UserProfileTous + "\\Application Data\\Microsoft\\Internet Explorer\\Quick Launch\\";
MenuDemarrerTous = UserProfileTous + "\\Menu Démarrer\\Programmes\\";
BureauTous = UserProfileTous + "\\Bureau\\";

path = WScript.ScriptFullName;
path = path.substr(0,path.lastIndexOf("\\")+1);

   // Variable RunOnceEx
RunOnceEx = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx";
DefaultRunOnce = "HKEY_USERS\\.DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce";
RunOnce = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce";

Utilisateur = Network.UserName;
Ordinateur = Network.ComputerName;

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