Jump to content

gunsmokingman

Super Moderator
  • Posts

    2,296
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Canada

Everything posted by gunsmokingman

  1. Could you post the contents of the bat file, I might be able to code it so it does not need the bat file. To make the script Ping without quiting, remove these lines from the script.
  2. I have made some minor changes to the script, it now has a Loop that will exit funtion after 10 unsuccesfull ping tries or 10 succesfull ping. Save As WmiPing2.vbs Dim Act :Set Act = CreateObject("wscript.Shell") Dim Wmi :Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Dim C1, C2, Obj, Png '-> Loop To Get User Input Do While Png = "" '-> Inputbox To Get User Input Png = InputBox( _ "Type in the IP Address or the Computer Name" & vbCrLf & _ "that you want to run the Ping Command on." & vbCrLf & _ "To do nothing type in either Exit Or Quit","Get IP Or Computer Name","",,475) '-> Exit The Script And Do Nothing If InStr(1,Png,"exit",1) Or InStr(1,Png,"quit",1) Then WScript.Quit End If Loop '-> Start The Ping Loop PingLoop() Function PingLoop() '-> Ping The Computer For Each Obj In Wmi.ExecQuery _ ("Select * From Win32_PingStatus where Address = '" & Png & "'") If IsNull(Obj.StatusCode) Or Obj.StatusCode <> 0 Then '-> Code Here If Computer Does Not Replies C1 = C1 + 1 Act.Popup "Total Ping : " & C1 & vbcrlf & _ "No Respond : " & Png, 3, "No Reply", 4128 '-> Quit After 10 Tries If C1 = 10 Then WScript.Quit Else '-> Code Here If Computer Replies C2 = C2 + 1 Act.Popup "Total Pings : " & C2 & vbcrlf & _ "Yes Respond : " & Png, 3, "Yes Reply", 4128 '-> Quit After 10 Tries If C2 = 10 Then WScript.Quit End If Next PingLoop() End Function
  3. This code is for Windows Server 2003 and Windows XP and up. Save As WmiPing.vbs Dim Wmi :Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Dim Obj, Png '-> Loop To Get User Input Do While Png = "" '-> Inputbox To Get User Input Png = InputBox( _ "Type in the IP Address or the Computer Name" & vbCrLf & _ "that you want to run the Ping Command on." & vbCrLf & _ "To do nothing type in either Exit Or Quit","Get IP Or Computer Name","",,475) '-> Exit The Script And Do Nothing If InStr(1,Png,"exit",1) Or InStr(1,Png,"quit",1) Then WScript.Quit End If Loop '-> Ping The Computer For Each Obj In Wmi.ExecQuery _ ("Select * From Win32_PingStatus where Address = '" & Png & "'") If IsNull(Obj.StatusCode) Or Obj.StatusCode <> 0 Then '-> Code Here If Computer Does Not Replies MsgBox "Did Not Respond : " & Png, 4128, "No Reply" Else '-> Code Here If Computer Replies MsgBox "Confirm Respond : " & Png, 4128, "Yes Reply" End If Next I have attach the above code as a text file just remove the.txt to make acrive.
  4. Perhaps try this, but problem with the above code is there is no error control. @Echo Off CLS Title Office 2003 Install Mode 77,9 Color F9 Echo. Echo Please Enter the Office 2003 license key, without the - seperator SET /P prodkey= CLS Echo. Echo Installing Office 2003 this will tale a few minutes to be completed. setup.exe TRANSFORMS="Unattended.MST" /qb+ /l pidkey=%prodkey% Here is a VBS script that will waits until the 25 characters for the key has been enter. To close the script Inputbox without adding the key is to type either exit or quit. Save As Ofc2003Install.vbs Dim UserIn '-> Loop To Wait For The 25 Character Key Do While Len(UserIn) < 25 UserIn = InputBox( _ "Enter in the Office 2003 license key." & vbcrlf & _ "Without using the - seperator" & vbcrlf & _ "Type Exit Or Quit to stop install" ,"Office Key Input","",,475) '-> Quit Or Exit Case Insensitive If InStr(1,UserIn,"quit",1) Or InStr(1,UserIn,"exit",1) Then WScript.Quit(0) End If '-> Error To Few Characters If Len(UserIn) =< 24 Then MsgBox "The Needs To Be 25 Characters Not This Many : " & Len(UserIn),4128,"Error To Few Characters" UserIn = "" End If '-> Correct Amount Of Characters, Start Install Office 2003 If Len(UserIn) = 25 Then CreateObject("Wscript.Shell").Run("setup.exe TRANSFORMS=" & _ Chr(34) & "Unattended.MST" & Chr(34) & " /qb+ /l pidkey=" & UserIn),1,True WScript.Quit(1) End If '-> Error To Many Characters If Len(UserIn) >= 26 Then UserIn = "" MsgBox "To Many Characters Press Ok To Continue",4128,"Error To Many Characters" End If Loop I have attach Ofc2003Install.vbs.txt just rename it to Ofc2003Install.vbs
  5. Like alway good work Yzöwl I was wondering if you can pass arguments to cmd promt, like something like this vbs script which with a little modification could do what you want. Argumnent I used in the run box to test the script C:\Users\Eddie\Desktop\Demo_DeleteFolder.vbs "Drive\Path_To_App\AppName.exe" ,"D:\Program Files (x86)" C:\Users\Eddie\Desktop\Demo_DeleteFolder.vbs "Drive\Path_To_App\AppName.exe" ,"Drive\Path_To_App" Script is coded to work only if 2 arguments are passed to it like the above, or 2 items are drag and drop on to the script. Save As Demo_DeleteFolder.vbs Dim Arg If Wscript.Arguments.Count = 2 Then For Each Arg In WScript.Arguments '-> App Path Name If Right(InStr(Arg,"."),3) Or Right(InStr(Arg,"."),4) Or Right(InStr(Arg,"."),5) Then WScript.Echo "File :" & Arg Else '-> Folder Path If InStr(1,Arg,"WINDOWS",1) Or InStr(1,Arg,"Program Files",1) Then WScript.Echo "Illegal Folder : " & Arg Else WScript.Echo "Folder :" & Arg End If End If Next '-> Various Error Messages ElseIf Wscript.Arguments.Count = 1 Then MsgBox "Not Enough Arguments Passed",4128,"One Argument" WScript.Quit ElseIf Wscript.Arguments.Count >= 3 Then MsgBox "To Many Arguments For This Script",4128,"More Then 3 Argument" WScript.Quit Else MsgBox "This Script Is Ment To Run With 2 Arguments",4128,"User Just Click Script" End If
  6. Here try this VBS Script, it should do what you wanted. I tested this so it has no runtime errors. Save As OemReg.vbs '-> Varibles And Objects Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Wmi :Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Dim Obj, Reg Reg = Act.ExpandEnvironmentStrings("%Systemroot%\OOBE\OEM\") '-> Wmi Querry For Computer Manufacture For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_ComputerSystem") If InStr(1,Obj.Manufacturer,"Acer",1) Then RegFileAdd("Acer") ElseIf InStr(1,Obj.Manufacturer,"Apple",1) Then RegFileAdd("Apple") ElseIf InStr(1,Obj.Manufacturer,"ASUS",1) Then RegFileAdd("ASUS") ElseIf InStr(1,Obj.Manufacturer,"eMachine",1) Then RegFileAdd("eMachine") ElseIf InStr(1,Obj.Manufacturer,"Gateway",1) Then RegFileAdd("Gateway") ElseIf InStr(1,Obj.Manufacturer,"HP",1) Then RegFileAdd("HP") ElseIf InStr(1,Obj.Manufacturer,"Toshiba",1) Then RegFileAdd("Toshiba") Else MsgBox "Can Not Determine The Computer Model", 4128,"Undetermine Computer Model" End If Next '-> Function To Add The Registry File Function RegFileAdd(Name) Reg = Reg & Name & "\" & Name & ".reg" If Fso.FileExists(Reg) Then Act.Run("Regedit /S " & Reg),1,True Else MsgBox "Error Can Not Find This File" & vbCrLf & _ Reg, 4128,"Reg File Missing" End If End Function I took the time to do a quick re-write of the above code. Changes 1:\ Added Array To Hold The Manufacture Name 2:\ Added A Second Loop Inside The Wmi Querry For Manufacture Using The Array For Reference. '-> Varibles And Objects Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Wmi :Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Dim Chk, Col, I, Obj, Reg Chk = False Reg = Act.ExpandEnvironmentStrings("%Systemroot%\OOBE\OEM\") '-> Array To Hold Manufacture Name Col = Array("Acer","Apple","ASUS","eMachine","Gateway", "HP", "Toshiba") '-> Wmi Querry For Computer Manufacture For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_ComputerSystem") For Each I In Col If InStr(1,Obj.Manufacturer,I,1) Then RegFileAdd(I) Chk = True End If Next Next '-> If There Was No Matching Manufacture If Chk = False Then MsgBox "Can Not Determine The Computer Model", 4128,"Undetermine Computer Model" End If '-> Function To Add The Registry File Function RegFileAdd(Name) Reg = Reg & Name & "\" & Name & ".reg" If Fso.FileExists(Reg) Then Act.Run("Regedit /S " & Reg),1,True Else MsgBox "Error Can Not Find This File" & vbCrLf & _ Reg, 4128,"Reg File Missing" End If End Function
  7. Here is the part of the script, where the pinging results are. Edit this area If IsNull(Obj.StatusCode) Or Obj.StatusCode <> 0 Then Results2 = Results2 & " Computer Off Line : " & i & vbCrLf Else Results1 = Results1 & " Computer On Line : " & i & vbCrLf End If
  8. Perhaps you could try this VBS script, run the script with cmd promt I coded it so it will display what folders might be created and where the code for the permission goes. Save As MakeUserFolder.vbs Change this before using Const ForReading = 1 Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Folder, Name, Path Dim Ts, TxtFile Path = Act.CurrentDirectory '-> The File To Be Process TxtFile = "COD4Servers.txt" Set Ts = Fso.OpenTextFile(TxtFile,ForReading) '-> Read The Text File Do Until Ts.AtEndOfStream Name = Ts.ReadLine '-> Filter To Remove Blank Lines If Not Len(Name) = 0 Then Folder = Path & "\" & Name '-> The Folder Does Not Exists If Not Fso.FolderExists(Folder) Then '-> Code Here To Add The Folder And Set Permissions WScript.Echo "Create Folder " & Folder WScript.Echo "Code Here For Permission" & vbCrLf WScript.Sleep 250 End If End If Loop Ts.Close
  9. You could use the Try Catch Try 'Your process start here Catch ex As Exception ' Code Here To Hanble Exception End Try
  10. I made a HTA for you to check out it has no code to make the ISO, but should give you a idea on how it would work. Save As DemoMkIsoGui.hta <TITLE>Make A Data Or Boot Iso</TITLE> <HTA:APPLICATION ID='GUI_mkisofs' Scroll='No' SCROLLFLAT ='No' SingleInstance='Yes' SysMenu='Yes' MaximizeButton='No' MinimizeButton='Yes' Border='Thin' BORDERSTYLE ='complex' INNERBORDER ='Yes' Caption='Yes' WindowState='Normal' APPLICATIONNAME='mkisofs_GUI' Icon='%SystemRoot%\explorer.exe'> <!-- A Way To Dim Shl :Set Shl = CreateObject("Shell.Application") Without Coding Any VBS Or JS Code --> <OBJECT ID="Shl" CLASSID="clsid:13709620-C279-11CE-A49E-444553540000"></OBJECT> <STYLE Type='text/css'> Body { Font-Size:10.25pt; Font-Weight:Bold; Font-Family:Segoe Ui, Lucida Console, Arial, Tahoma, Comic Sans MS; Color:#203063; BackGround-Color:Transparent; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#ece6e0',EndColorStr='#c0bab4'); Margin-Top:5; Margin-Bottom:5; Margin-Left:2; Margin-Right:2; Padding-Top:5; Padding-Bottom:5; Padding-Left:2; Padding-Right:2; Text-Align:Center; Vertical-Align:Top; Border-Top:1px Solid #dbd5d1; Border-Bottom:2px Solid #c6c1ba; Border-Left:1px Solid #c1bdb9; Border-Right:2px Solid #d7d1cb; } BUTTON { Cursor:Hand; Width:95pt; Height:15pt; Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Segoe Ui, Lucida Console, Arial, Tahoma, Comic Sans MS; Color:#001141; Text-Align:Center; Vertical-Align:Middle; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='AliceBlue',endColorStr='LightSlateGray'); Border-Top:0px Transparent; Border-Bottom:0px Transparent; Border-Left:0px Transparent; Border-Right:0px Transparent; Padding-Top:0; Padding-Bottom:2; Padding-Left:0; Padding-Right:0; Margin-Top:1; Margin-Bottom:1; Margin-Left:1; Margin-Right:1; BackGround-Color:Transparent; } .B1 { Color:#004111; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#BAEABA',endColorStr='#226644'); } TD.Txt1 { Width:296pt; Font-Size:9.05pt; Font-Weight:Bold; Color:#141414; Font-Family:Lucida Console; Padding-Left:1pt; Padding-Right:1pt; } .Txt2 { Width:311pt; Font-Size:9.75pt; Font-Weight:Bold; Color:#004523; Margin-Top:0; Margin-Bottom:0; Margin-Left:0; Margin-Right:0; Padding-Top:1; Padding-Bottom:1; Padding-Left:4; Padding-Right:4; } .Txt3 { Width:91pt; Font-Size:9.05pt; Font-Weight:Bold; Color:#121212; Padding-Left:4; Padding-Right:4; } .TBox1 { Font-Size:8.25pt; Font-Weight:Bold; Color:#1E1E1E; Filter:Progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#faf6ef',EndColorStr='#efebe5'); Padding-top:1; Padding-bottom:1; Border-Top:1px Solid #cbc7c3; Border-Bottom:2px Solid #a6a29e; Border-Left:1px Solid #bcb8b4; Border-Right:2px Solid #b2aeaa; } Table.T1 { Margin-Top:0; Margin-Bottom:0; Margin-Left:0; Margin-Right:0; Padding-Top:1; Padding-Bottom:1; Padding-Left:5pt; Padding-Right:5pt; } </STYLE> <script LANGUAGE='VBScript'> Const MyComp = &H11& '-> Varibles For Runtime Dim Boot, BurnIso, Fld, IsoChk, TxtMsg1 TxtMsg1="Select The Iso Source Folder , Or Press Cancel To Exit Script And Do Nothing" '-> Resize And Move Window To Approx Center Screen self.Focus self.resizeTo 555,375 self.MoveTo screen.availWidth / 2 - 555/2,screen.availHeight / 2 - 375/2 '-> Add Coode To Check For Boot Bin And Other Files Function Window_OnLoad() End Function '-> To Make Sure Only One Checkbox Get selected Function CheckBoxReturns(Bt) If Uc01.Checked = True And Uc02.Checked = False Then Boot = Bt Uc02.disabled = True ElseIf Uc01.Checked = False And Uc02.Checked = False Then Boot = "" Uc01.disabled = False Uc02.disabled = False ElseIf Uc01.Checked = False And Uc02.Checked = True Then Boot = Bt Uc01.disabled = True End If End Function '-> Brows For Dialog To Get Source And Output Folders Function BrowsForFolder(Out) Set Fld = Shl.BrowseForFolder( 0, TxtMsg1,16,MyComp) If Fld Is Nothing Then If Out = True Then Out = "Cancel At Adding Source FolderFor Iso Creation" If Out = False Then Out = "Cancel At Adding Output For Folder Iso Creation" alert(Out) Exit Function Else If Out Then IsoDir.value = Fld.Items.Item.Path Else IsoOut.value = Fld.Items.Item.Path End If End If End Function '-> Main Work Function Of The HTA Function DoTheWork() If Boot = "" Then alert(vbtab & "Error 1" & vbcrlf & "Please Select Either The Data Or Boot Checkbox") Else If IsoDir.value = "" And IsoOut.value = "" Then alert(vbtab & "Error 2" & vbcrlf & _ "Can Not Make The Iso Without A" & vbcrlf & _ "Source Folder And Output Folder") ElseIf Len(IsoDir.value) =< 6 And IsoOut.value = "" Then alert(vbtab & "Error 3" & vbcrlf & _ "The Source Folder Is Less Then 3 Characters" & vbcrlf & _ "The Output Folder Has Not Been Selected Yet") IsoDir.value = "" ElseIf Len(IsoDir.value) >= 6 And Len(IsoOut.value) =< 6 Then alert(vbtab & "Error 4" & vbcrlf & _ "Source Folder " & vbtab & IsoDir.value & vbcrlf & _ "The Output Folder Is Less Then 3 Characters") IsoOut.value = "" ElseIf Len(IsoDir.value) >= 6 And Len(IsoOut.value) >= 6 Then If Boot = True Then CheckIsoNameLength(16) Else CheckIsoNameLength(32) End If '-> Passes Final Check If IsoChk = True Then '-> Confirm Start If Confirm(vbtab & "Confirm Information" & vbcrlf & _ "Make Bootable Iso " & vbtab & Boot & vbcrlf & _ "Iso Source Folder " & vbtab & IsoDir.value & vbcrlf & _ "Iso Output Folder " & vbtab & IsoOut.value & vbcrlf & _ "Iso Image Name " & vbtab & BurnIso) Then alert("Code Here To Start The Burning Process") Else '-> User Cancel Re Set All Varibles alert("Re-Setting All Varibles Back To Nothing") Boot = "" :IsoDir.value = "" :IsoOut.value = "" BurnIso = "" :IsoChk = "" Uc01.disabled = False Uc02.disabled = False End If '-> Confirm End Else '-> Either Iso Name Was Blank Or It Exceeded Max Length alert(vbtab & "Error 5" & vbcrlf & _ "The Name Is Either O Length Or Exceeds Max Characters." & vbcrlf & _ "If This Is A Data Name It Max Size Is 32 Characters" & vbcrlf & _ "If This Is A Boot Name It Max Size Is 16 Characters") NamIso.value = "" End If End If End If End Function '-> Check Length Make Sure It 1 Character Long And Under Max Characters Function CheckIsoNameLength(Lgh) If Len(NamIso.value) < Lgh And Len(NamIso.value) > 1 Then IsoChk = True BurnIso = NamIso.value Else IsoChk = False End If End Function </SCRIPT> <BODY Scroll='No'>Instructions On How Use <!-- TEXT INFORMATION --> <!-- 1 --> <TABLE Border='1' Class='T1'><TD Class='Txt2'> 1:\ Press The Brows For Button, To Fill In Textbox 1 And 2 </TD></TABLE> <!-- 2 --> <TABLE Border='1' Class='T1'><TD Class='Txt2'> 2:\ Type In The Name For Your Iso In Textbox 3 </TD></TABLE> <!-- 3 --> <TABLE Border='1' Class='T1'><TD Class='Txt2'> 3:\ Select Either The Data Or Boot CheckBox </TD></TABLE> <!-- 3 --> <TABLE Border='1' Class='T1'><TD Class='Txt2'> 4:\ Press The Build Iso Button To Make Your CD DVD </TD></TABLE> <!-- SOURCE FOLDER ISO --> <TABLE Align='Center' Border='1'><TD Class='Txt3'>1:\ Iso Source Folder</TD><TD> <INPUT Type='Text' ID='IsoDir' Class='TBox1' Size='44'> </TD></TABLE> <!-- OUTPUT FOLDER ISO --> <TABLE Align='Center' Border='1'><TD Class='Txt3'>2:\ Iso Output Folder</TD><TD> <INPUT Type='Text' ID='IsoOut' Class='TBox1' Size='44'> </TD></TABLE> <!-- NAME ISO --> <TABLE Align='Center' Border='1'><TD Class='Txt3'>3:\ Iso Image Name</TD><TD> <INPUT Type='Text' ID='NamIso' Class='TBox1' Size='44'> </TD></TABLE> <!-- DATA ISO --> <TABLE Style='Text-Align:Center;' Border='1'><TD> <INPUT Type='CheckBox' ID='Uc01' Name='Uc01'OnClick='CheckBoxReturns(False)'></TD> <TD Class='Txt1'>Data ISO, For CD/DVD Music, Backup, Storage</TD></TABLE> <!-- BOOTABLE ISO --> <TABLE Style='Text-Align:Center;' Border='1'><TD> <INPUT Type='CheckBox' ID='Uc02' Name='Uc02' OnClick='CheckBoxReturns(True)'></TD> <TD Class='Txt1'>Boot ISO, For Installing Or Repairing An Os</TD></TABLE> <!-- START BUTTON CONTAINER --> <TABLE Border='1' Style='Width:323pt;Text-Align:Center;'><TD> <!-- INLINE SCRIPTING --> <BUTTON ID='Btn01' OnClick=" If Btn01.innerHTML = 'Brows For Source Iso' Then TxtMsg1 = TxtMsg1 BrowsForFolder(True) Btn01.innerHTML = 'Brows For Output Iso' Else TxtMsg1 = Replace(TxtMsg1,'Source','Output') BrowsForFolder(False) Btn01.innerHTML = 'Brows For Source Iso' End If ">Brows For Source Iso</BUTTON> <!-- Build Iso Button --> <BUTTON ID='Btn02' OnClick="DoTheWork()">Build Iso</BUTTON> <!-- Close Button --> <BUTTON ID='Btn03' OnClick="window.close">Close</BUTTON> </TD></TABLE> <!-- END BUTTON CONTAINER --> </BODY>
  11. jaclaz Vbs Code For Drap Drop Folder Or Open a Brows for Dialog, all that is needed is the code to make the iso. Const MyComp = &H11& Dim Boot, IsoFolder, Obj, Var If Wscript.Arguments.Count = 1 Then For Each Obj In WScript.Arguments If Right(InStr(Obj,"."),4) Or Right(InStr(Obj,"."),5) Then WScript.Echo "Error This Is Only For Folders Only" Else UserSelection(Obj) End If Next Else ManualSelectFolder() End If '-> Confirm Folder Path And Boot Or Data Iso Function ConfirmIt() If MsgBox("Is This The Correct Folder Path And Swich" & vbCrLf & IsoFolder,4132, "Results") = 6 Then If Boot Then MsgBox "Place Code To Make Boot Iso" & vbCrLf & "Bootable = " & Boot Else MsgBox "Place Code To Make Data Iso" & vbCrLf & "Bootable = " & Boot End If Else ManualSelectFolder() End If End function '-> User Choice Boot Data Quit Function UserSelection(Obj) Var = MsgBox( _ vbTab & "Make Iso Instructions" & vbCrLf & _ "Press Yes To Make A Bootable Iso" & vbCrLf & _ "Press No To Make A Data Iso" & vbCrLf & _ "Press Cancel To Exit Script" & vbCrLf & _ Obj, 4131,"Make Iso") If Var = 2 Then MsgBox "User Cancel Iso Creation", 4128,"Cancel Iso" WScript.Quit(0) ElseIf Var = 6 Then IsoFolder = Obj Boot = True ElseIf Var = 7 Then IsoFolder = Obj Boot = False End If ConfirmIt() End Function '-> Open A Brows For Folder Dialog Function ManualSelectFolder() Dim Shl :Set Shl = CreateObject("Shell.Application") Dim Fld :Set Fld = Shl.BrowseForFolder( _ 0, "Select The Iso Source Folder, Or Press Cancel To Exit Script And Do Nothing",16,MyComp) If Fld Is Nothing Then MsgBox "User Cancel Manual Add Folder",4128,"User Cancel" WScript.Quit(1) Else UserSelection(Fld.Items.Item.Path) End If End Function
  12. Here is my effort at a cmd with choice @Echo Off :Main CLS && Color A9 && Title Main Menu && Mode 65, 9 Echo. Echo Press 1 to install app no switches Echo Press 2 to install app /swiches Echo Press 3 to exit Echo. SET Choice= SET /P Choice= Type Either 1 Or 2 Or 3 ^>^ IF /I '%Choice%'=='1' GOTO 1 IF /I '%Choice%'=='2' GOTO 2 IF /I '%Choice%'=='3' GOTO 3 ::Incase The Input Was Wrong CLS && Color 9b && Title Invalid Choice && mode 65,7 ECHO. ECHO This reply %Choice% is not valid. Please try again. ECHO. ping -n 3 127.0.0.1>nul GOTO Main :: Choice 1 :1 CLS && Color F9 && Title Choice 1 Selected && mode 65,7 Echo. Echo This will self close in 3 seconds Echo. ping -n 3 127.0.0.1>nul | set /p = Press Enter To Close Goto :End :: Choice 2 :2 CLS && Color F8 && Title Choice 2 Selected && mode 65,7 Echo. Echo This will self close in 3 seconds Echo. ping -n 3 127.0.0.1>nul | set /p = Press Enter To Close Goto :End :: Choice 3 :3 CLS && Color F8 && Title Choice 3 Selected && mode 65,7 Echo. Echo This will self close in 3 seconds Echo. ping -n 3 127.0.0.1>nul | set /p = Press Enter To Close Goto :End :End Exit
  13. It might be better idea to use a VBS Script or an HTA with VBS Or Js Scripting to do what you want.
  14. If you where to use the hta, this is the value you would pass to the batch cmd. To your batch cmd for /F "tokens=1-4 delims=/- " %%A in ('date/T') do md VarToPass.value\%%A%%B%%C for /F "tokens=1-4 delims=/- " %%A in ('date/T') do move VarToPass.value\*.* c:\usergiven\%%A%%B%%C To code it in the hta If InStr(VarToPass.value, ":\") And Len(VarToPass.value) > 5 Then Dim Act :Set Act = CreateObject("Wscript.Shell") Act.Run("Cmd.exe /C @Echo Off && for /F ""tokens=1-4 delims=/- "" %%A in ('date/T') do md " & VarToPass.value & "\%%A%%B%%C"),1,True Act.Run("Cmd.exe /C @Echo Off && for /F ""tokens=1-4 delims=/- "" %%A in ('date/T') do move " & VarToPass.value & "\%%A%%B%%C"),1,True Here are some reasons 1:\ Better error handling then cmd promt. 2:\ Better looking GUI for the end user. 3:\ Easier to work with strings Could you post the contents of your batch file, it might be easy to convert it to VBS. If you want to get a string in cmd promt @Echo Off Title Get User Input :Main CLS MODE 62,9 Color A9 Echo. Echo Type in some string SET /P UC=^> If /I '%UC%'=='' GOTO NoText If /I '%UC%'=='%UC%' GOTO Choice1 :NoText CLS Color CF ECHO. ECHO This was not valid ping -n 3 127.0.0.1>nul GOTO Main :Choice1 CLS Echo. Echo %UC% pause
  15. You have a couple of simple options Here is a VBS script that uses a loop to get the user input. Save As UserInputDemo.vbs Dim A1 : '-> Loop To Get The User Input Do While A1 = "" '-> Inputbox To Get User Input A1 = InputBox( _ "Some Text Here With Some Details About What" & vbCrLf & _ "You Want The User To Do. Display An Example" & vbCrLf & _ "Some_Drive_Letter:\Path_Of_Folder\Folder" & vbCrLf & vbCrLf & _ "Some Instruction On How To Quit This." & vbCrLf & _ "Type Either Exit Or Quit To Do Nothing") '-> Code To Exit The Script If A1 = "quit" Or A1 = "exit" Then WScript.Quit(0) End If '-> Check To Make Sure The Pathway Like This EG C:\Abc Would Be Correct If InStr(A1, ":\") And Len(A1) > 5 Then MsgBox "Code Here To Do What You Want." WScript.Quit(1) Else '-> Check To Make Sure The Pathway Like This EG C:\Ab Would Fail MsgBox "This Is Not A Valid Pathway" A1 = "" End If Loop The other way would be a HTA, this HTA I coded in the Brows For Folder Dialog as a way to get a pathway. Save As DemoUserInput.hta <TITLE> « Demo Get User Input »</TITLE> <HTA:APPLICATION ID='DemoGetUserInput' Scroll='No' SCROLLFLAT ='No' SingleInstance='Yes' SysMenu='Yes' MaximizeButton='No' MinimizeButton='Yes' Border='Thin' BORDERSTYLE ='complex' INNERBORDER ='Yes' Caption='Yes' WindowState='Normal' APPLICATIONNAME='GetUserInputDemo' Icon='%SystemRoot%\explorer.exe'> <!-- For How The Window Is Display --> <STYLE Type='text/css'> Body { Font-Size:12.55pt; Font-Weight:Bold; Font-Family:Segoe Ui, Lucida Console, Arial, Tahoma, Comic Sans MS; Color:Black; BackGround-Color:Transparent; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#ece6e0',EndColorStr='#c0bab4'); Margin-Top:1; Margin-Bottom:1; Margin-Left:4; Margin-Right:4; Padding-Top:1; Padding-Bottom:1; Padding-Left:4; Padding-Right:4; Text-Align:Center; Vertical-Align:Top; Border-Top:0px Transparent; Border-Bottom:0px Transparent; Border-Left:0px Transparent; Border-Right:0px Transparent; } TD { Font-Size:8.55pt; Font-Weight:Bold; } TD.Big { Font-Size:9.55pt; Font-Weight:Bold; } .Txt { Font-Size:8.25pt; Font-Weight:Bold; } BUTTON { Width:71pt; Height:14pt; Cursor:Hand; Font-Size:8.25pt; Font-Weight:Bold; Color:#001137; Text-Align:Center; Vertical-Align:Middle; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='AliceBlue',endColorStr='LightSlateGray'); Border-Top:0px Transparent; Border-Bottom:0px Transparent; Border-Left:0px Transparent; Border-Right:0px Transparent; Padding-Top:0; Padding-Bottom:2; Padding-Left:0; Padding-Right:0; Margin-Top:1; Margin-Bottom:1; Margin-Left:1; Margin-Right:1; BackGround-Color:Transparent; } </STYLE> <!-- VBS Script Language --> <script Language="VBScript"> Const MyComp = &H11& '-> Resize And Move Window Dim Wth :Wth = int(429) Dim Hht :Hht = int(229) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2)) '-> Vbs Object Dim Shl :Set Shl = CreateObject("Shell.Application") '-> Varible For Use In Script Dim UserObject '-> Open The Brow For Folder DiaLOG Function BrowsForTheFolder() Dim Fld :Set Fld = Shl.BrowseForFolder(0, "Select The User Folder",16,MyComp) If Fld Is Nothing Then alert "User Cancel Brow For Dialog" Else Set UserObject = Fld.Self ' alert UserObject.Path VarToPass.value = UserObject.Path End If End Function '-> Submit Button Function Function SetUserChoice() '-> Check To Make Sure The Pathway Like This EG C:\Abc Would Be Correct If Not VarToPass.value = "" Then If InStr(VarToPass.value, ":\") And Len(VarToPass.value) > 5 Then alert "Code Here" Else '-> Check To Make Sure The Pathway Like This EG C:\Ab Would Fail alert "This Is Not A Valid Pathway" VarToPass.value = "" End If Else alert "This Is No Pathway Listed" & Vbcrlf & _ "Please Type In The Pathway" & Vbcrlf & _ "Or Use The Brows Button To" & Vbcrlf & _ "Supply A Valid Pathway" End If End Function </SCRIPT> <BODY Scroll='No'> <!-- Top Text Display --> <TABLE>Title That You Want To Display</TABLE> <!-- Main Text Display --> <TABLE Style='Width:99%;Height:32pt;Text-Align:Left;Margin-Top:3pt;Padding-Left:2pt;'><TD> Some Text Here With Some Details About What You Want The User To Do. Some More Detail To Help The User. Or Press The Brows Button To Open A Brows For Folder Dialog, To Select The Target Folder. </TD></TABLE> <!-- Example Text Display --> <TABLE Style='Width:99%;Text-Align:Left;'><TD Class='Big'> <FONT Style='Color:DarkGreen;'>Example » </FONT> Some_Drive_Letter:\Path_Of_Folder\Folder </TD></TABLE> <!-- Textbox Input Area --> <TABLE Style='Width:99%;Text-Align:Center;'><TD> <INPUT Type='Text' Name='VarToPass' Size='60' Class='Txt'> </TD></TABLE> <!-- Button Area --> <TABLE Style='Width:99%;Text-Align:Center;'><TD> <BUTTON ID='BrowForFolder' OnClick='BrowsForTheFolder()'>Brows</BUTTON> <BUTTON ID='SubmitPathWay' OnClick='SetUserChoice()'>Submit</BUTTON> <BUTTON ID='CloseTheWindow' OnClick='window.close()'>Close</BUTTON> </TD></TABLE> </BODY>
  16. if this is the first line of the script Get the SMBIOS asset tag from the Win32_SystemEnclosure class it should be like this to avoid the error, your missing the comment out ' ' Get the SMBIOS asset tag from the Win32_SystemEnclosure class
  17. Im confused are you opening another HTA that had the reboot or is it a button function not working? If you are trying to have a custom dialog for rebooting perhaps try this. Save As DemoDialog.hta <TITLE> « Custom Dialog »</TITLE> <HTA:APPLICATION ID='Demo_Dialog' Scroll='No' SCROLLFLAT ='No' SingleInstance='Yes' SysMenu='Yes' MaximizeButton='No' MinimizeButton='Yes' Border='Thin' BORDERSTYLE ='complex' INNERBORDER ='Yes' Caption='Yes' WindowState='Normal' APPLICATIONNAME='DemoDialog' Icon='%SystemRoot%\explorer.exe'> <STYLE Type='text/css'> Body { Font-Size:12.25pt; Font-Weight:Bold; Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui; Color:Black; BackGround-Color:Transparent; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#ece6e0',EndColorStr='#c0bab4'); Margin-Top:3; Margin-Bottom:3; Margin-Left:4; Margin-Right:4; Padding-Top:2; Padding-Bottom:2; Padding-Left:4; Padding-Right:4; Text-Align:Center; Vertical-Align:Top; Border-Top:0px Transparent; Border-Bottom:0px Transparent; Border-Left:0px Transparent; Border-Right:0px Transparent; } BUTTON { Cursor:Hand; Width:77pt; Height:13pt; Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui; Color:#001141; Text-Align:Center; Vertical-Align:Middle; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='AliceBlue',endColorStr='LightSlateGray'); Border-Top:0px Transparent; Border-Bottom:0px Transparent; Border-Left:0px Transparent; Border-Right:0px Transparent; Padding-Top:0; Padding-Bottom:2; Padding-Left:0; Padding-Right:0; Margin-Top:1; Margin-Bottom:1; Margin-Left:1; Margin-Right:1; BackGround-Color:Transparent; } .M1 { Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui; Color:#001141; Text-Align:Center; Vertical-Align:Center; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#fdf7e1',EndColorStr='#b0a9a3'); Padding-Top:5; Padding-Bottom:5; Padding-Left:5; Padding-Right:5; Border-Top:1px solid; Border-Bottom:1px solid; Border-Left:1px solid; Border-Right:1px solid; } </STYLE> <script LANGUAGE='JScript'> window.resizeTo (425,227) window.moveTo(screen.availWidth / 2 - (425/2),screen.availHeight / 2 - (227/2)) // Show The Restart Dialog function ShowMenu01() { if(Dialog01.style.visibility=="hidden") { Dialog01.style.visibility=""; } else { Dialog01.style.visibility="hidden"; }} // Restart Computer function RebootComp() { alert('Code Here'); Dialog01.style.visibility="hidden"; } </SCRIPT> <BODY Scroll='No'> <Table Width='100%' Align='Left' Style='Padding:5pt;'> <BUTTON ID='Btn01' OnClick='ShowMenu01()'>Restart</BUTTON> </TABLE> <!-- Hidden Dialog Until Restart Button Pressed --> <DIV ID='Dialog01' Class='M1' Style='visibility:hidden;position:absolute;Top:62;Left:125;Padding-Bottom:7px;Width:201pt;Height:48pt;'> <DIV Style='position:absolute;Top:13;Left:18;'>Press Confirm To Reboot the Computer</DIV> <BUTTON ID='Btn02' OnClick='RebootComp()' Style='position:absolute;Top:36;Left:28;'>Confirm</BUTTON> <BUTTON ID='Btn03' OnClick='ShowMenu01()' Style='position:absolute;Top:36;Left:133;'>Cancel</BUTTON> </Div> </BODY>
  18. Try this code, adjust to suite your needs. Dim objShell :Set objShell = CreateObject("WScript.Shell") Sub confirmation2 If MsgBox("Would You Like To Do Some Thing?",4132,"Confirmation") = 6 Then objShell.Run("Exe /Switches),0,true End Sub
  19. You will have to edit the Boot.ini to do what you want. I think you can also use MsConfig to edit the start up.
  20. Simple Examples Of Math In VB 2008 Minus 8 - 4 Plus 8 + 4 Division 8 / 4 Multiplication 8 * 4
  21. My computer came with 8 gb of ram, and a quad core processor.
  22. No, because I could not use the 8 gb of ram I have on a 32 bit OS.
  23. No I dont have a floppy disk, but I tested on sdhc card. Try this script, it going to list each drive as either active or empty Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Obj, Z1, Z2 For Each Obj In Fso.Drives If Obj.IsReady Then Z1 = Z1 & vbCrLf & "Active" & vbTab & Obj Else Z2 = Z2 & vbCrLf & "Empty " & vbTab & Obj End If Next MsgBox Z1 & vbCrLf & Z2 My Results, with no errors. --------------------------- --------------------------- Active C: Active D: Active E: Active F: Active G: Active I: Active J: Empty H: Empty K: Empty L: Empty M: Empty N: --------------------------- OK ---------------------------
  24. The second VBS scripts works fine on my computer. You have to fill below in File = ":\SOME_FOLDER\FILE.NAME" The script only reports active drives, so if there nothing in the drive it ignores that drive.
×
×
  • Create New...