Jump to content

Variables Help please


Dessip

Recommended Posts

Hey atm i am creating a cd change so that the user inputs the amunt of cds install that he has, then it will copy all of the files over, and then ask for the next cd, But i was wondering if there is a variable for the current CD Rom drive, as i know that here is %Systemdrive% for the local HDD/HDD partition that the OS was installed to, but im not sure waht the command is for the CD Drive (If there is even one), Or if there isnt then with out useing the IF C:/blah.txt exist then CDROM = C:/ anf having loads of them in your program that will make it look untidy, is there anyother way that anyone can think of.

Also does anyone know in VB if there is away to put a application switch in, so if the user puts /1 it will think that there is only 1 CD to install

(I will release it once i have finnished)

Thanks Dessip

Link to comment
Share on other sites


No, unfortunately there is no such variable...

As you supposed, you need a batch file to do this:

TITLE Setting the %settings% variable
CLS
@ECHO OFF
IF EXIST C:\__SETTINGS__ set SETTINGS=C:\__SETTINGS__
IF EXIST D:\__SETTINGS__ set SETTINGS=D:\__SETTINGS__
IF EXIST E:\__SETTINGS__ set SETTINGS=E:\__SETTINGS__
IF EXIST F:\__SETTINGS__ set SETTINGS=F:\__SETTINGS__
IF EXIST G:\__SETTINGS__ set SETTINGS=G:\__SETTINGS__
IF EXIST H:\__SETTINGS__ set SETTINGS=H:\__SETTINGS__
IF EXIST I:\__SETTINGS__ set SETTINGS=I:\__SETTINGS__
IF EXIST J:\__SETTINGS__ set SETTINGS=J:\__SETTINGS__
IF EXIST K:\__SETTINGS__ set SETTINGS=K:\__SETTINGS__
IF EXIST L:\__SETTINGS__ set SETTINGS=L:\__SETTINGS__
IF EXIST M:\__SETTINGS__ set SETTINGS=M:\__SETTINGS__
IF EXIST N:\__SETTINGS__ set SETTINGS=N:\__SETTINGS__
IF EXIST O:\__SETTINGS__ set SETTINGS=O:\__SETTINGS__
IF EXIST P:\__SETTINGS__ set SETTINGS=P:\__SETTINGS__
IF EXIST Q:\__SETTINGS__ set SETTINGS=Q:\__SETTINGS__
IF EXIST R:\__SETTINGS__ set SETTINGS=R:\__SETTINGS__
IF EXIST S:\__SETTINGS__ set SETTINGS=S:\__SETTINGS__
IF EXIST T:\__SETTINGS__ set SETTINGS=T:\__SETTINGS__
IF EXIST U:\__SETTINGS__ set SETTINGS=U:\__SETTINGS__
IF EXIST V:\__SETTINGS__ set SETTINGS=V:\__SETTINGS__
IF EXIST W:\__SETTINGS__ set SETTINGS=W:\__SETTINGS__
IF EXIST X:\__SETTINGS__ set SETTINGS=X:\__SETTINGS__
IF EXIST Y:\__SETTINGS__ set SETTINGS=Y:\__SETTINGS__
IF EXIST Z:\__SETTINGS__ set SETTINGS=Z:\__SETTINGS_
EXIT

In this batch the variable "SETTINGS" is made if there's a folder __SETTINGS__ found in the root of a HDD/CD/DVD.

Link to comment
Share on other sites

In your VB app you can make a registry read of this entry

HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\SourcePath

SourcePath is the drive used for installing Windows (if install via cd drive then this value is the drive letter of the computer cd)

Link to comment
Share on other sites

The following will set a variable strCDROM to the CDROM drive letter in a vbscript.

Modify to suit your need.

Set objDrives = CreateObject("Scripting.FileSystemObject").Drives
For Each Drive In objDrives
If Drive.DriveType = "4" Then strCDROM = Drive.DriveLetter & ":"
Next

Also does anyone know in VB if there is away to put a application switch in, so if the user puts /1 it will think that there is only 1 CD to install

Provide more details on what you are trying to accomplish, may be able to help you.

Link to comment
Share on other sites

Hey i have alreay dont it, jsut adding the finaly touches to it now. Then got to test it, Also i would rather Use API then Objects, as i know that API id deffonatly gonig to be installed when i run the EXE.

Also i have done the application switch, it was not that hard, just didnt reaklise that i actually knew what i needed to do, Just got to modify it abit.

But thank you foryour help

Dessip

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