Jump to content

Install with switches from HTML


Recommended Posts

@zbeta

Do you think it is possible to have all my command into one single file using AutoIT? What I mean is for now I have to create a batch file for every program I want to install silently (with switches). I would be great if I could store all theses commands into one single file and triger the proper command from my HTML Front-end...

Also, where do you get those cool set of icon like the one you sent me?

Link to comment
Share on other sites


But what happens to the script two threads above if i have two or even three CD Drives?

my install CD is in the second? That routine only finds the first drive.

Dont work for me it keeps telling me my Hard Drive is a CDROM.............ooops my mistake changed the cmd to CDROM.cmd :P

this would work better, but it will only work if you have a cd.txt document in the root of the CD.

echo off
mode con: cols=55 lines=2
title CdVar
color 9f

> Cd.vbs echo Dim ts
>> Cd.vbs echo Set fso = CreateObject("Scripting.FileSystemObject")
>> Cd.vbs echo For Each objDrive In fso.Drives
>> Cd.vbs echo If objDrive.DriveType = "4" And objDrive.IsReady Then
>> Cd.vbs echo If fso.FileExists(objDrive ^& "\cd.txt") Then strDriveLetter = objDrive
>> Cd.vbs echo End If
>> Cd.vbs echo Next
>> Cd.vbs echo Set ts = fso.CreateTextFile("cd.cmd", True, False)
>> Cd.vbs echo ts.WriteLine "set " ^& Left(WScript.ScriptName, InStr(WScript.ScriptName, ".") - 1) ^& "=" ^& strDriveLetter
>> Cd.vbs echo ts.Close

ping -n 2 127.0.0.1>nul
start wscript.exe Cd.vbs
ping -n 2 127.0.0.1>nul

call Cd.cmd

cls
mode con: cols=55 lines=5
color 2b
echo.
echo Your Cd Is %CD%
echo.
echo set cdrom=%CD%
echo.
ping -n 3 127.0.0.1>nul

exit

Link to comment
Share on other sites

This one will you what the cd without a batch file

Dim CDdrv, Fso 'As Scripting.FileSystemObject
Const CDROM = 4
On Error Resume Next
Set Fso = CreateObject("Scripting.FileSystemObject")
strDriveLetter = ""
For intDriveLetter = Asc("D") To Asc("Z")
Err.Clear
If Fso.GetDrive(Chr(intDriveLetter)).DriveType = CDROM Then
If Err.Number = 0 Then
strDriveLetter = Chr(intDriveLetter)
CDdrv = strDriveLetter
Exit For
End If
End If
Next
L=MsgBox ("Your Cd Is: " & CDdrv,0 + 48,"The Cd Is: " & CDdrv)
wscript.quit

Edited by gunsmokingman
Link to comment
Share on other sites

I dont Know if this will work. I Have Only One CD Drive,

I added loop to the code.

Dim CDdrv, Counter , Fso, RBox
Counter = 0
Const CDROM = 4
Do Until RBox = vbcancel
On Error Resume Next
Set Fso = CreateObject("Scripting.FileSystemObject")
strDriveLetter = ""
For intDriveLetter = Asc("A") To Asc("Z")
Err.Clear
If Fso.GetDrive(Chr(intDriveLetter)).DriveType = CDROM Then
If Err.Number = 0 Then
strDriveLetter = Chr(intDriveLetter)
CDdrv = strDriveLetter
Exit For
End If
End If
Next
Do Until Counter = 10
Counter = Counter + 1
RBox = MsgBox("Your Cd Is: " & CDdrv & vbCrLf & "Press Cancel To Quit" & vbCrLf & Counter,1 + 48,"The Cd Is: " & CDdrv)
If Counter = 10 Then
RBox = vbcancel
MsgBox "The Loop Ran 10 Times" & vbCrLf & "Preparing To Exit Script", 0 + 32,"End Loop"
End If
Exit Do
Loop
Loop

Edited by gunsmokingman
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...