Jump to content

CMD File Help


Recommended Posts

The Topic title pretty much covers it but this is my problem:

I've seen this in Several CMD's but cannot understand how to do it.

I want to Ask a User to input something. Then that something becomes a variable (I think that's the word), i.e. Set Name=Something; (With Something being the User's Input).

I need to edit Reg settings after the Setup. But I want my Windows Setup to be a base setup that is customized in some parts by the user after the Setup, so it can be flexible.

Please Help me, :) , Your my only hope. Thanks in advance.

[offtopic]I hope this is in the right section.[/offtopic]

Link to comment
Share on other sites


I can only encourage u to run it from a .vbs script instead.. easier, better and more efficient IMHO, example:

Option Explicit

Dim Input, Command, WshShell

Set WshShell = WScript.CreateObject("WScript.Shell")

Input = InputBox("Application .exe name to run")
MsgBox ("You entered: " & Input)

'Exec the application of choice or whatever...
ExecApp(Input)

'******************
'* Execute Function
'******************
Function ExecApp(pstrCommand)
Command = WshShell.Run(pstrCommand, 0, True)
End Function

Try for example: calc.exe and it will be launched.. u can then replace that with reg load or something else...

Link to comment
Share on other sites

To assign user input to an environment variable, use SET /P. For example:

SET /P INPUT=Type some input:
ECHO Your input was: %INPUT%

Type SET /? in a command prompt window for details.

Yes, that easy. And the %INPUT% variable (as given by Ctrl-X) is valid during the session of your batch file

where you used SET.

In the same batch file, you can SET other variable like INPUT1, INPUT2, and so on.

Link to comment
Share on other sites

Sorry to ask another Question but; Where in the registry are:

1 - Computer Name (As in the one in My Computer -> Properties -> Computer Name (Tab) -> Full Computer Name: ______)

2 - User Name (As in the one in My Computer -> Properties ->Registered to: ________) [e.g. Bob Jones]

3 - Company Name (As in the one in My Computer -> Properties ->Registered to: ________) [e.g. Bob Jones P/L]

Thanks in advance.

EDIT: My Current Files are as follows:

COMPUTERNAME.cmd

@echo off

TITLE=Post Windows Setup Customization

SET KEY=???

ECHO Type in the Name of this

ECHO Computer and then press Enter

:COMPUTERNAME

ECHO.

SET /P COMPUTERNAME=Computer Name:

ECHO Your input was: %COMPUTERNAME%

ECHO Type in YES to Change it or NO to Confirm.

:CHANGE

SET /P CHANGE=Change:

IF "%CHANGE%"=="YES" goto :COMPUTERNAME

IF "%CHANGE%"=="yes" goto :COMPUTERNAME

IF "%CHANGE%"=="Yes" goto :COMPUTERNAME

IF "%CHANGE%"=="yEs" goto :COMPUTERNAME

IF "%CHANGE%"=="yeS" goto :COMPUTERNAME

IF "%CHANGE%"=="YeS" goto :COMPUTERNAME

IF "%CHANGE%"=="YEs" goto :COMPUTERNAME

IF "%CHANGE%"=="NO" goto :REGISTRY

IF "%CHANGE%"=="no" goto :REGISTRY

IF "%CHANGE%"=="nO" goto :REGISTRY

IF "%CHANGE%"=="No" goto :REGISTRY

ECHO Error! Please Try again...

goto :CHANGE

:REGISTRY

REG ADD %KEY%

goto :END

:END

ECHO.

SET /P END=Press Enter to Exit...

exit

USERNAME.cmd
@echo off

TITLE=Post Windows Setup Customization

SET KEY=???

ECHO Type in your Name

ECHO and then press Enter

:NAME

ECHO.

SET /P NAME=Name:

ECHO Your input was: %NAME%

ECHO Type in YES to Change it or NO to Confirm.

:CHANGE

SET /P CHANGE=Change:

IF "%CHANGE%"=="YES" goto :NAME

IF "%CHANGE%"=="yes" goto :NAME

IF "%CHANGE%"=="Yes" goto :NAME

IF "%CHANGE%"=="yEs" goto :NAME

IF "%CHANGE%"=="yeS" goto :NAME

IF "%CHANGE%"=="YeS" goto :NAME

IF "%CHANGE%"=="YEs" goto :NAME

IF "%CHANGE%"=="Y" goto :NAME

IF "%CHANGE%"=="y" goto :NAME

IF "%CHANGE%"=="NO" goto :REGISTRY

IF "%CHANGE%"=="no" goto :REGISTRY

IF "%CHANGE%"=="nO" goto :REGISTRY

IF "%CHANGE%"=="No" goto :REGISTRY

IF "%CHANGE%"=="N" goto :REGISTRY

IF "%CHANGE%"=="n" goto :REGISTRY

ECHO Error! Please Try again...

goto :CHANGE

:REGISTRY

REG ADD %KEY%

goto :END

:END

ECHO.

SET /P Exit=Press Enter to Exit...

exit

COMPANYNAME.cmd

@echo off

TITLE=Post Windows Setup Customization

SET KEY=???

ECHO Type in the Name of your

ECHO Company and then press Enter

:COMPANYNAME

ECHO.

SET /P COMPANYNAME=Company Name:

ECHO Your input was: %COMPANYNAME%

ECHO Type in YES to Change it or NO to Confirm.

:CHANGE

SET /P CHANGE=Change:

IF "%CHANGE%"=="YES" goto :COMPANYNAME

IF "%CHANGE%"=="yes" goto :COMPANYNAME

IF "%CHANGE%"=="Yes" goto :COMPANYNAME

IF "%CHANGE%"=="yEs" goto :COMPANYNAME

IF "%CHANGE%"=="yeS" goto :COMPANYNAME

IF "%CHANGE%"=="YeS" goto :COMPANYNAME

IF "%CHANGE%"=="YEs" goto :COMPANYNAME

IF "%CHANGE%"=="NO" goto :REGISTRY

IF "%CHANGE%"=="no" goto :REGISTRY

IF "%CHANGE%"=="nO" goto :REGISTRY

IF "%CHANGE%"=="No" goto :REGISTRY

ECHO Error! Please Try again...

goto :CHANGE

:REGISTRY

REG ADD %KEY%

goto :END

:END

ECHO.

SET /P END=Press Enter to Exit...

exit

%KEY% in Each one is where the Appropriate Reg Entry is and the Variable set in the file is what will be Actually added as the "String Value".

EDIT 2: If it is Possible to Simplify the Stuff under :Change, any advice would be much appreciated.

Edited by mandrake10
Link to comment
Share on other sites

A couple of ideas:


@echo off
:CHANGE
SET /P CHANGE=Change:

For %%A in (YES YEs Yes yes yeS yES yEs YeS NO No no nO) DO IF %%A.==%CHANGE%. GOTO :Nextstep%CHANGE%
ECHO Error! Please Try again...
goto :CHANGE

:NextstepYES
REM was :COMPANYNAME
ECHO COMPANYNAME %CHANGE%
PAUSE
goto :CHANGE

:NextstepNO
REM was :REGISTRY
ECHO REGISTRY %CHANGE%
PAUSE
goto :CHANGE


@echo off
:CHANGE
SET /P CHANGE=Change:
ECHO %CHANGE% | FIND /I "YES " >nul
IF %ERRORLEVEL%==0 goto :COMPANYNAME
ECHO %CHANGE% | FIND /I "NO " >nul
IF %ERRORLEVEL%==0 goto :REGISTRY
ECHO Error! Please Try again...
goto :CHANGE

:COMPANYNAME
ECHO COMPANYNAME %CHANGE%
PAUSE
goto :CHANGE

:REGISTRY
ECHO REGISTRY %CHANGE%
PAUSE
goto :CHANGE

Please note that in your source you missed a couple of combination for "yEs"....

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

IF has a switch to do case insensitive comparisons.

<HTML>
<HEAD>
<TITLE>Owner Company & PC Name</TITLE>
<HTA:APPLICATION
applicationname="Owner Company & PC Name"
maximizebutton="no"
minimizebutton="no"
scroll="no"
showintaskbar="no"
singleinstance="yes"
/>
</HEAD>
<script language="VBScript">
Sub regEdit
strOrg = TextBox0.Value
strName = TextBox1.Value
strPC = TextBox2.Value
Set oFS = CreateObject("Scripting.FileSystemObject")
If strOrg = "" Then
MsgBox "You need to fill in " & chr(34) & "Company" & chr(34),64,"Alert"
document.getElementByID("textbox0").select
ElseIf strName = "" Then
MsgBox "You need to fill in " & chr(34) & "Owner" & chr(34),64,"Alert"
document.getElementByID("textbox1").select
ElseIf strPC = "" Then
MsgBox "You need to fill in " & chr(34) & "PC Name" & chr(34),64,"Alert"
document.getElementByID("textbox2").select
Else
Set strScript = oFS.OpenTextFile("Add2Reg.vbs",8,True)
strScript.WriteLine "Set oShell = WScript.CreateObject(" & chr(34) & "WScript.Shell" & chr(34) & ")"
strScript.WriteLine "Set oFS = CreateObject(" & chr(34) & "Scripting.FileSystemObject" & chr(34) & ")"
strScript.WriteLine "strRoot = " & chr(34) & "HKLM" & chr(34)
strScript.WriteLine "strOne = " & chr(34) & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" & chr(34) & ""
strScript.WriteLine "strTwo = " & chr(34) & "\System\CurrentControlSet\Control\ComputerName\ComputerName\" & chr(34) & ""
strScript.WriteLine "strOrg = " & chr(34) & strOrg & chr(34)
strScript.WriteLine "strName = " & chr(34) & strName & chr(34)
strScript.WriteLine "strPC = " & chr(34) & strPC & chr(34)
strScript.WriteLine "oShell.RegWrite strRoot & strOne & " & chr(34) & "RegisteredOrganization" & chr(34) & ", strOrg"
strScript.WriteLine "oShell.RegWrite strRoot & strOne & " & chr(34) & "RegisteredOwner" & chr(34) & ", strName"
strScript.WriteLine "oShell.RegWrite strRoot & strTwo & " & chr(34) & "ComputerName" & chr(34) & ", strPC"
strScript.WriteLine "oFS.DeleteFile(WScript.ScriptFullName)"
strScript.Close
call runScript
End If
End Sub
Sub runScript
Set oShell = CreateObject("WScript.Shell")
oShell.Run "Add2Reg.vbs"
End Sub
Sub reload
window.location.reload
End Sub
Sub bodyLoaded()
window.ResizeTo 402,220 ' WIDTH, HEIGHT
TextBox0.focus()
End Sub
</SCRIPT>
<BODY onLoad="bodyLoaded()" STYLE="font:12 pt arial; color:white;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000000', EndColorStr='#00CC00')"
>
<TABLE width="90%" border="0" cellpadding="6" align="left">
<COLGROUP width="100%">
<COL width="12%">
<COL width="44%">
<COL width="44%">
</COLGROUP>
<TR>
<TD><B>&#187;&#160;Company&#160;&#58;</B></TD>
<TD colspan="2"><input type="text" size="36" name="textbox0"></TD>
</TR>
<TR>
<TD><B>&#187;&#160;Owner&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#58;</B></TD>
<TD colspan="2"><input type="text" size="36" name="textbox1"></TD>
</TR>
<TD><B>&#187;&#160;PC</B>&#160;<B>Name&#160;&#160;&#58;</B></TD>
<TD colspan="2"><input type="text" size="36" name="textbox2"></TD>
<TR>
<TD align="left" valign="bottom"><font color="white" size="1">Yz&#246;wl&#160;&#169;2006</font></TD>
<TD align="right"><input type="button" value="Submit&#160;Data" name="run_button" onClick="regEdit"></TD>
<TD align="right"><input type="button" value="Cancel" name="close_button" onClick="Self.Close"></TD>
</TR>
</TABLE>
</BODY>

GSM, will probably be able to improve it too!

Link to comment
Share on other sites

Thank You Yzöwl

I have made some cosmetic changes to what you have done

<!-- ORIGINAL HTA AND SCRIPT BY YZOWL 
HTA RE EDIT BY GUNSMOKINGMAN -->
<HTML><HEAD>
<TITLE>Owner Company & PC Name</TITLE>
<HTA:APPLICATION
applicationname="Owner Company & PC Name"
maximizebutton="no"
minimizebutton="no"
scroll="no"
showintaskbar="no"
singleinstance="yes"
Icon="%SystemRoot%\explorer.exe">
<STYLE type="text/css">
Body
{
font:10.75pt;
font-family: arial, Verdana, Palatino Linotype;
color:#E3E3E3;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0, StartColorStr='#00CC00', EndColorStr='#4E4E4E');
padding-top:1;
padding-bottom:1;
Text-Align:;
}
.Button
{
font: 8.25pt;
font-family: Verdana, Palatino Linotype;
color:#E1E1E1;
font-weight:bold;
Text-Align:Center;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0,StartColorStr='#d0d0d0',endColorStr='#008C80');
padding-top:1;
padding-bottom:1;
cursor:Hand;
Height:19; width:93;
border-left: 1px Transparent;
border-right: 2px Transparent;
border-top: 1px Transparent;
border-Bottom: 2px Transparent;
}
.TextBackGround
{
font:8.25pt; font-family: arial, Verdana, Palatino Linotype;
color:#1E1E1E;
font-weight:bold;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0,StartColorStr='#e2ded8',EndColorStr='#e8e2de;');
padding-top:1; padding-bottom:1;
border-left: 3px Transparent;
border-right: 2px Transparent;
border-top: 3px Transparent;
border-Bottom: 2px Transparent;
}
</STYLE>
<script Language="JavaScript">
var Act = new ActiveXObject("Wscript.Shell");
var Fso = new ActiveXObject("Scripting.FileSystemObject");
/* CLOSE THE HTA -> */
function ExitThis() { window.close();}
/* RUN BUTTON CHANGE TEXT -> */
function Button1ChangeText() { if (Run_Button.value =="Submit Data")
{Run_Button.value ='Press To Add'
Txt1.innerHTML= 'All Three Text Boxes Must Be Filled In. If Any<BR>' +
'Text Box Is Not Filled In It Will Not Run The Script!' }
else {Run_Button.value ='Submit Data', Txt1.innerHTML= '';}}
/* CLEAR BUTTON CHANGE TEXT -> */
function Button2ChangeText() { if (Clear_Button.value =="Clear Text")
{Clear_Button.value ='Clear All Text'} else {Clear_Button.value ='Clear Text';}}
/* CLOSE BUTTON CHANGE TEXT -> */
function Button3ChangeText() { if (Close_Button.value =="Close App")
{Close_Button.value ='Good Bye'} else {Close_Button.value ='Close App';}}
</SCRIPT>
<script language="VBScript">
Dim strName, strOrg, strPC
'/-> TEXT BOXES SCRIPTS
Function RegEdit()
strOrg = TextBox0.Value : strName = TextBox1.Value : strPC = TextBox2.Value
If strOrg = "" Then
window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Company" & chr(34)
document.getElementByID("textbox0").select
ElseIf strName = "" Then
window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Owner" & chr(34),64,"Alert"
document.getElementByID("textbox1").select
ElseIf strPC = "" Then
window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "PC Name" & chr(34),64,"Alert"
document.getElementByID("textbox2").select
Else
Set strScript = Fso.CreateTextFile("Add2Reg.vbs")
strScript.WriteLine "Set Act = CreateObject(" & chr(34) & "WScript.Shell" & chr(34) & ")"
strScript.WriteLine "Set Fso = CreateObject(" & chr(34) & "Scripting.FileSystemObject" & chr(34) & ")"
strScript.WriteLine "strRoot = " & chr(34) & "HKLM" & chr(34)
strScript.WriteLine "strOne = " & chr(34) & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" & chr(34) & ""
strScript.WriteLine "strTwo = " & chr(34) & "\System\CurrentControlSet\Control\ComputerName\ComputerName\" & chr(34) & ""
strScript.WriteLine "strOrg = " & chr(34) & strOrg & chr(34)
strScript.WriteLine "strName = " & chr(34) & strName & chr(34)
strScript.WriteLine "strPC = " & chr(34) & strPC & chr(34)
strScript.WriteLine "Act.RegWrite strRoot & strOne & " & chr(34) & "RegisteredOrganization" & chr(34) & ", strOrg"
strScript.WriteLine "Act.RegWrite strRoot & strOne & " & chr(34) & "RegisteredOwner" & chr(34) & ", strName"
strScript.WriteLine "Act.RegWrite strRoot & strTwo & " & chr(34) & "ComputerName" & chr(34) & ", strPC"
strScript.WriteLine "Fso.DeleteFile(WScript.ScriptFullName)"
strScript.Close
call RunScript
End If
End Function
'/-> RUN NEW SCRIPT
Function RunScript() : Act.Run("Add2Reg.vbs"), 1, True : End Function
'/-> CLEAR THE TEXT BOXES
Function ClearText() : TextBox0.Value = "" : TextBox1.Value = "" : TextBox2.Value = "" : End Function
'/-> ON LOAD EVENT
Function window_Onload() : window.ResizeTo 402,220 : TextBox0.focus() : End Function
</SCRIPT>
</HEAD><BODY><CENTER>
<!-- TEXT BOX TABLE START --><TABLE width='90%' border='0' cellpadding='6'><TD>
<!-- TEXT BOX 01 START -->
<TABLE><TD Width='125'><B>» Company</TD><TD> :</B></TD>
<TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox0">
</TD></TABLE>
<!-- TEXT BOX 02 START -->
<TABLE><TD Width='125'><B>» Owner</TD><TD> :</B></TD>
<TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox1">
</TD></TABLE>
<!-- TEXT BOX 03 START -->
<TABLE><TD Width='125'><B>» PC Name</TD><TD> :</B></TD>
<TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox2"></TD>
</TABLE></TD>
<!-- TEXT BOX TABLE END --></TABLE>
<!-- BUTTON TABLE START --><TABLE>
<!-- RUN BUTTON START -->
<TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Submit Data" name="Run_Button"
OnMouseOver="Button1ChangeText(),this.style.color='#004f1a';"
OnMouseOut="Button1ChangeText(),this.style.color='#E1E1E1';"
onClick="RegEdit()"></TD>
<!-- CLEAR BUTTON START -->
<TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Clear Text" name="Clear_Button"
OnMouseOver="Button2ChangeText(),this.style.color='#004f1a';"
OnMouseOut="Button2ChangeText(),this.style.color='#E1E1E1';"
onClick="ClearText()"></TD>
<!-- CLOSE BUTTON START -->
<TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Close App" name="Close_Button"
OnMouseOver="Button3ChangeText(),this.style.color='#004f1a';"
OnMouseOut="Button3ChangeText(),this.style.color='#E1E1E1';"
onClick="ExitThis()"></TD>
<!-- BUTTON TABLE END --> </TABLE></CENTER>
<!-- YZOWL TABLE START -->
<TABLE><TD WIDTH='300' HEIGHT='32' Style='font:8.75pt;Color:"#E1E1E1"'><SPAN ID='Txt1'></SPAN></TD>
<TD><FONT color="#E1E1E1" size="1.25">Yzöwl ©2006</FONT></TD></TABLE>
<!-- YZOWL TABLE END -->
</BODY></HTML>

I have included the hta in a rar file

ChangeComputerInfo.rar

Edited by gunsmokingman
Link to comment
Share on other sites

Thanks guys (or girls, :angel) for your help, it is very appreciated. :thumbup

Now i hope i can help you one day.

EDIT: Hello, :hello: . Code tweaked by Mua:

<!-- ORIGINAL HTA AND SCRIPT BY YZOWL
HTA EDIT BY GUNSMOKINGMAN
HTA RE-EDIT BY BETA4ME -->
<HTML><HEAD>
<TITLE>Owner, Organization & PC Name</TITLE>
<HTA:APPLICATION
applicationname="Owner, Organization & PC Name"
maximizebutton="no"
minimizebutton="yes"
scroll="no"
showintaskbar="yes"
singleinstance="yes"
Icon="%SystemRoot%\explorer.exe">
<STYLE type="text/css">
Body
{
font:10.75pt;
font-family: arial, Verdana, Palatino Linotype;
color:#E3E3E3;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0, StartColorStr='#00CC00', EndColorStr='#4E4E4E');
padding-top:1;
padding-bottom:1;
Text-Align:;
}
.Button
{
font: 8.25pt;
font-family: Verdana, Palatino Linotype;
color:#E1E1E1;
font-weight:bold;
Text-Align:Center;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0,StartColorStr='#d0d0d0',endColorStr='#008C80');
padding-top:1;
padding-bottom:1;
cursor:Hand;
Height:19; width:93;
border-left: 1px Transparent;
border-right: 2px Transparent;
border-top: 1px Transparent;
border-Bottom: 2px Transparent;
}
.TextBackGround
{
font-family: arial, Verdana, Palatino Linotype;
color:#1E1E1E;
font-weight:bold;
filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=#e2ded8,EndColorStr=#e8e2de;
padding-top:1; padding-bottom:1;
border-left: 3px none Transparent;
border-right: 2px none Transparent;
border-top: 3px none Transparent;
border-Bottom: 2px none Transparent;; font-style:normal; font-variant:normal; font-size:8.25pt
}
</STYLE>
<script Language="JavaScript">
var Act = new ActiveXObject("Wscript.Shell");
var Fso = new ActiveXObject("Scripting.FileSystemObject");
/* CLOSE THE HTA -> */
function ExitThis() { window.close();}
/* RUN BUTTON CHANGE TEXT -> */
function Button1ChangeText() { if (Run_Button.value =="Submit Data")
{Run_Button.value ='Press To Add'
Txt1.innerHTML= 'All Three Text Boxes Must Be Filled In. <BR>If Any ' +
'Text Box Is Not Filled In It Will Not <BR>Run The Script!' }
else {Run_Button.value ='Submit Data', Txt1.innerHTML= '';}}
/* CLEAR BUTTON CHANGE TEXT -> */
function Button2ChangeText() { if (Clear_Button.value =="Clear Text")
{Clear_Button.value ='Clear Text'} else {Clear_Button.value ='Clear Text';}}
/* CLOSE BUTTON CHANGE TEXT -> */
function Button3ChangeText() { if (Close_Button.value =="Close App")
{Close_Button.value ='Close App'} else {Close_Button.value ='Close App';}}
</SCRIPT>
<script language="VBScript">
Dim strName, strOrg, strPC
'/-> TEXT BOXES SCRIPTS
Function RegEdit()
strOrg = TextBox0.Value : strName = TextBox1.Value : strPC = TextBox2.Value
If strOrg = "" Then
window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Organization" & chr(34)
document.getElementByID("textbox0").select
ElseIf strName = "" Then
window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Owner" & chr(34),64,"Alert"
document.getElementByID("textbox1").select
ElseIf strPC = "" Then
window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "PC Name" & chr(34),64,"Alert"
document.getElementByID("textbox2").select
Else
Set strScript = Fso.CreateTextFile("Add2Reg.vbs")
strScript.WriteLine "Set Act = CreateObject(" & chr(34) & "WScript.Shell" & chr(34) & ")"
strScript.WriteLine "Set Fso = CreateObject(" & chr(34) & "Scripting.FileSystemObject" & chr(34) & ")"
strScript.WriteLine "strRoot = " & chr(34) & "HKLM" & chr(34)
strScript.WriteLine "strOne = " & chr(34) & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" & chr(34) & ""
strScript.WriteLine "strTwo = " & chr(34) & "\System\CurrentControlSet\Control\ComputerName\ComputerName\" & chr(34) & ""
strScript.WriteLine "strThree = " & chr(34) & "\System\ControlSet001\Control\ComputerName\ComputerName\" & chr(34) & ""
strScript.WriteLine "strFour = " & chr(34) & "\System\ControlSet002\Control\ComputerName\ComputerName\" & chr(34) & ""
strScript.WriteLine "strFive = " & chr(34) & "\System\CurrentControlSet\Control\ComputerName\ActiveComputerName\" & chr(34) & ""
strScript.WriteLine "strSix = " & chr(34) & "\System\ControlSet001\Control\ComputerName\ActiveComputerName\" & chr(34) & ""
strScript.WriteLine "strOrg = " & chr(34) & strOrg & chr(34)
strScript.WriteLine "strName = " & chr(34) & strName & chr(34)
strScript.WriteLine "strPC = " & chr(34) & strPC & chr(34)
strScript.WriteLine "Act.RegWrite strRoot & strOne & " & chr(34) & "RegisteredOrganization" & chr(34) & ", strOrg"
strScript.WriteLine "Act.RegWrite strRoot & strOne & " & chr(34) & "RegisteredOwner" & chr(34) & ", strName"
strScript.WriteLine "Act.RegWrite strRoot & strTwo & " & chr(34) & "ComputerName" & chr(34) & ", strPC"
strScript.WriteLine "Act.RegWrite strRoot & strThree & " & chr(34) & "ComputerName" & chr(34) & ", strPC"
strScript.WriteLine "Act.RegWrite strRoot & strFour & " & chr(34) & "ComputerName" & chr(34) & ", strPC"
strScript.WriteLine "Act.RegWrite strRoot & strFive & " & chr(34) & "ComputerName" & chr(34) & ", strPC"
strScript.WriteLine "Act.RegWrite strRoot & strSix & " & chr(34) & "ComputerName" & chr(34) & ", strPC"
strScript.WriteLine "Fso.DeleteFile(WScript.ScriptFullName)"
strScript.Close
call RunScript
End If
End Function
'/-> RUN NEW SCRIPT AND THEN DELETE THE SCRIPT
Function RunScript() : Act.Run("Add2Reg.vbs"), 1, True : End Function
'/-> CLEAR THE TEXT BOXES
Function ClearText() : TextBox0.Value = "" : TextBox1.Value = "" : TextBox2.Value = "" : End Function
'/-> ON LOAD EVENT
Function window_Onload() : window.ResizeTo 440,260 : TextBox0.focus() : End Function
</SCRIPT>
</HEAD><BODY><CENTER>
<!-- TEXT BOX TABLE START --><TABLE width='90%' border='1' cellpadding='6'><TD>
<!-- TEXT BOX 01 START -->
<TABLE><TD Width='125'><B>» Organization</TD><TD> :</B></TD>
<TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox0">
</TD></TABLE>
<!-- TEXT BOX 02 START -->
<TABLE><TD Width='125'><B>» Owner</TD><TD> :</B></TD>
<TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox1">
</TD></TABLE>
<!-- TEXT BOX 03 START -->
<TABLE><TD Width='125'><B>» PC Name</TD><TD> :</B></TD>
<TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox2"></TD>
</TABLE></TD>
<!-- TEXT BOX TABLE END --></TABLE>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<!-- BUTTON TABLE START --><TABLE>
<!-- RUN BUTTON START -->
<TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Submit Data" name="Run_Button"
OnMouseOver="Button1ChangeText(),this.style.color='#004f1a';"
OnMouseOut="Button1ChangeText(),this.style.color='#E1E1E1';"
onClick="RegEdit()"></TD>
<!-- CLEAR BUTTON START -->
<TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Clear Text" name="Clear_Button"
OnMouseOver="Button2ChangeText(),this.style.color='#004f1a';"
OnMouseOut="Button2ChangeText(),this.style.color='#E1E1E1';"
onClick="ClearText()"></TD>
<!-- CLOSE BUTTON START -->
<TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Close App" name="Close_Button"
OnMouseOver="Button3ChangeText(),this.style.color='#004f1a';"
OnMouseOut="Button3ChangeText(),this.style.color='#E1E1E1';"
onClick="ExitThis()"></TD>
<!-- BUTTON TABLE END --> </TABLE></CENTER>
<!-- Yzöwl TABLE START -->
<TABLE><TD WIDTH='236' HEIGHT='47' Style='font:8.75pt;Color:"#E1E1E1"'><SPAN ID='Txt1'></SPAN></TD>
<TD><FONT color="#E1E1E1" size="1.25">© 2006 Yzöwl. All Rights Reserved</FONT></TD></TABLE>
<!-- Yzöwl TABLE END -->
</BODY></HTML>

Tell me what you think!

Edited by mandrake10
Link to comment
Share on other sites

Bugger, the Reg Entries in there DON'T change the Computer Name. Org & Owner Name's work but Computer Name don't, any help please. :hello:

EDIT: NVM. The My Computer Properties shows the old Name :realmad: . But Windows actually recognizes it as the new name :huh: . Weird, huh :wacko: . Is there some-way to "Refresh" or "Update" the dialogue? Plzzzz...

EDIT 2: Even after Reboots still shows old name.

Edited by mandrake10
Link to comment
Share on other sites

OK, just for the record, now that everyone has had his part of fun :thumbup and hopefully mandrake10 has learned a few neat tricks, why not using a more featured, pre-made FREEWARE and OPEN SOURCE app?:

http://gravityfx.org/

http://gravityfx.org/?id=projects

http://gravityfx.org/?id=wxp

(a .NET solution, so not really useful unless you need .NET for any other more meaningful reason)

jaclaz

Link to comment
Share on other sites

OK, just for the record, now that everyone has had his part of fun :thumbup and hopefully mandrake10 has learned a few neat tricks, why not using a more featured, pre-made FREEWARE and OPEN SOURCE app?:

http://gravityfx.org/

http://gravityfx.org/?id=projects

http://gravityfx.org/?id=wxp

(a .NET solution, so not really useful unless you need .NET for any other more meaningful reason)

jaclaz

Thanks for that, it's got tonnes of Tweak Settings, but would take too long to use to Mod my system. If you read my posts up above; I need to Edit the Computer Name, Owner's Name & Organization's Name ONLY. My CMD's work fine, and the HTA is great (Nice GUI). It does what i need it to do no more, no less. My Reg tweaks are imported during the Windows Setup and RunOnceEx, so i do not need to tweak anything more.

If someone could answer this question:

EDIT: NVM. The My Computer Properties shows the old Name :realmad: . But Windows actually recognizes it as the new name :huh: . Weird, huh. Is there some-way to "Refresh" or "Update" the dialogue? Plzzzz...

EDIT 2: Even after Reboots still shows old name.

that is all I need :yes: , thanks... ;)

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