totoymola Posted December 2, 2004 Share Posted December 2, 2004 @popWhy don't you start by reading the official MS guide for DOS commands first? You will find the uses of that commands there. Well, not all commands and tricks are listed there, but I'm sure that will help you a lot. Type %systemroot%\help\ntcmds.chm on your run command.@MhzA *.cmd file will not execute on a 9x operating system. Commands in a *.cmd file may not work for a 9x system. This difference ensures that scripts made for one type of system are not functional on another type of system. This is a major issue if they are treated the same.Thanks for the clarification! I didn't know that. Link to comment Share on other sites More sharing options...
pob Posted December 3, 2004 Author Share Posted December 3, 2004 hmmm... this could take some time, but thanx anyway. should find enough here to bung together a batch file.... Link to comment Share on other sites More sharing options...
gunsmokingman Posted December 4, 2004 Share Posted December 4, 2004 (edited) I have Up Dated My Template CmdIt Now Will Do This1:\ Run A Very Simple Demo Of User Input From Cmd To VBS Back To CmdThis Means You will Type Something Than It Open Another Vbs Box With What You Inputted. Than A Cmd Window Will Echo Back Your Responce2:\ Run A VBS Script To Set The Cd Var3:\ Make And Remove Folder Threw The Vbs Function4:\ Make And Run A Simple Cmd You Input These ParamatersName Of The CmdThe Width Of The ScreenThe Hieght Of The SceenThe Background And Text ColorA Message That Will Echo Out What You Type InThan Run The Cmd That You Made5:\ Make A RunOnceEx.cmd This One You Have To Add All The SwitchesI made It To Save Me Typing A New One Each Time I Decided To Update My CD.ECHO offcls:: WHERE THE MAIN MENU IS MADE, AND THE RETURN FROM THE OTHER PARTS OF THE CMD. SOFTWARE IS THE NAME THAT CMD LOOKS FOR :Softwareclsmode con: cols=60 lines=29COLOR 7FTITLE $$$MAIN MENU:: TO SET THING LIKE SYSTEMDRIVE TO WHAT YOU WANTSET SD=%systemdrive%\SET SCD=%CDROM%Apps\:: THIS IS TO STOP THIS SCRIPT 1000=1 SECOND > Rst0.vbs ECHO Wscript.sleep 125>> Rst0.vbs ECHO Wscript.quit > Rst1.vbs ECHO Wscript.sleep 875>> Rst1.vbs ECHO Wscript.quit > Rst2.vbs ECHO Wscript.sleep 1875>> Rst2.vbs ECHO Wscript.quit > Rst3.vbs ECHO Wscript.sleep 2875>> Rst3.vbs ECHO Wscript.quit > Rst4.vbs ECHO Wscript.sleep 4475>> Rst4.vbs ECHO Wscript.quit:: VARIBLES TO SAVE TIME FROM RETYPINGSET Size3=mode con: cols=45 lines=3SET Size3A=mode con: cols=55 lines=3SET Size5=mode con: cols=55 lines=5SET Size7=mode con: cols=55 lines=7SET Size11=mode con: cols=60 lines=11:: VARIBLES THAT START A ACTION. I AM TO LAZY TO TYPESET R0=start /w Rst0.vbsSET R1=start /w Rst1.vbsSET R2=start /w Rst2.vbsSET R3=start /w Rst3.vbsSET R4=start /w Rst4.vbs:: A HELPFULL HINT YOU CAN EDIT THE CMD FILE WHILE IT RUNNING:: VARIBLES FOR TEXT. I AM DISLEXIC SO IT EASY FOR ME TO PLACE SOME TEXT MESSAGES HERESET TXMSG1=PLACE A INSTALL ORDER HERESET TXMSG2=Demo For Getting UserInput Back To Cmd Or Msgbox:: VARIBLES USED TO MAKE THE MENUSET MN1A=ºÄÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍĺSET MN2A=ºÄÄÄÄÄÄÄÄÄÄÄÄÄ Menu :: VARIBLE USED BY THE VBS SCRIPTSSET T=VBTABSET V=VBCRLFSET BP=BuildPathSET FN=strFileNameSET S9=Space(9)SET T3=T3 TEST TEXT MESSAGESET T4=Gsm Cmd To Vbs DemoSET T5=For Demo Loop:SET T6=Press YesSET T7=Press NoSET Z1=Welcome To My Cmd To Vbs TemplateSET ZA=This Will Cause The Cmd To GoSET ZB=The Next Mini Demo LoopSET UI=strUserInSET WL=WriteLineSET COS=%COS%SET COT=CreateObject("Shell.Application")SET COW=CreateObject("WScript.Shell")SET GAP=GetAbsolutePathNameSET OTF=OpenTextFileverECHO ÉÄÍÍÍÍÍÍÍÍ MY DEMO ÍÍÍ MENU ÍÍÍÍÍÍÍÍÍÍÄ»ECHO %MN1A%ECHO %MN2A%1 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĺECHO ºÄ TYPE: ALL VBS DEMO BACK TO CMD ĺ ECHO %MN1A%ECHO %MN2A%2 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĺECHO %MN1A%ECHO ºÄ TYPE: CDD DEMO SET CD VAR ĺ ECHO ºÄ USES A VBS SCRIPT TO SET CD VAR ĺECHO %MN1A% ECHO %MN2A%3 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĺECHO %MN1A%ECHO ºÄ TYPE: MRD DEMO MKDIR RMDIR VBS ĺECHO %MN1A%ECHO %MN2A%4 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĺECHO %MN1A%ECHO ºÄ TYPE: OUT DEMO VBS MAKE A CMD ĺ ECHO %MN1A%ECHO %MN2A%5 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĺECHO %MN1A%ECHO ºÄ TYPE: RUN MY RUN1 MAKER ĺECHO %MN1A%ECHO ºÄ Q. Quit CLEAN UP SCRIPT FILES ĺ ECHO ÈÄÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍļ Time /tECHO.:: SET /P prompts for input and sets the variable:: to whatever the user types:: You Can Name Anything After /P To What You Want:: The Name Must Match What Between >'%UC%'< After The /ISET UC=SET /P UC=Type What On The Menu Than Press Enter: :: To Increase The Amount Of Text To Input :: '%UC%'=='LEAVE HERE WITH THE AMOUNT SPACE BLANK':: BELOW 3 EXAMPLES THE DEFUALT IS SET TO 3 LETTERS:: SO NOW THE MENU WORKS WITH EITHER 1 2 3 OR 3 LETTERS:: The syntax in the next line extracts the substring:: starting at 0 (the beginning) and 1 character long EG A, 1, Z, 4::IF NOT '%UC%'=='' SET Choice=%UC:~0,1%:: starting at 0 (the beginning) and 2 character long EG AB, AT, ZZ ::IF NOT '%UC%'==' ' SET Choice=%UC:~0,2%:: starting at 0 (the beginning) and 3 character long EG BAT, CAT, MAT ,HATIF NOT '%UC%'==' ' SET Choice=%UC:~0,3%:: /I makes the IF comparison case-insensitiveIF /I '%UC%'=='All' GOTO Menu1IF /I '%UC%'=='CDD' GOTO Menu2IF /I '%UC%'=='MRD' GOTO Menu3IF /I '%UC%'=='OUT' GOTO Menu4IF /I '%UC%'=='RUN' GOTO Menu5IF /I '%UC%'=='Q' GOTO EndECHO "%UC%" is not valid. Please try again.GOTO %UC%:: GOTO MEANS IT NEED A PLACE TO GO TO LIKE THE NAME SAYS.:: Menu1, Menu2, Menu3, Menu4, Menu5 ARE THE SPOTS IN THE BATCH FILE WHERE WE GOTO FROM SOFTWARE ::THAN WE GOTO SOFTWARE FROM Menu1, Menu2, Menu3, Menu4, Menu5:Menu1:ALLCLS%Size3a%COLOR 9FTITLE DEMO VBS BACK TO CMD > reply.vbs echo %UI% = Inputbox("Type Some Thing In The Box" ^& V ^&_>> reply.vbs echo "What You Type Will Appear In the next Box","TEST USER INPUT","{-TYPE A REPLY HERE-}", 8700,4600)>> reply.vbs echo Set fs = CreateObject("Scripting.FileSystemObject") >> reply.vbs echo %FN% = fs.%BP%(Wscript.ScriptFullName ^& "\..", "reply.cmd") >> reply.vbs echo %FN% = fs.%GAP%(strFileName) >> reply.vbs echo Set ts = fs.%OTF%(strFileName, 2, True)>> reply.vbs echo ts.%WL% "set reply=" ^& %UI% >> reply.vbs echo ts.Close>> reply.vbs echo Msgbox "You Reponce Was:" ^& %UI% , vbokonly+64,"TEST REPLY RESPONCE"ECHO.ECHO %TXMSG2% %R2%start reply.vbsECHO.set /p = Press Any Key To Go On?CLSTITLE VBS BACK TO CMD RESPONCECOLOR B0call reply.cmd%R1%Echo.echo %Reply%%R3%del reply.vbsdel reply.cmd%R0%GOTO Software:Menu2:CDDCLS%Size3%COLOR 9ETITLE MENU SELECTION 2 Example Varible:: THIS IS THE VBS PART THAT FINDS THE CD DRIVE> RCd.vbs ECHO Dim ts>> RCd.vbs ECHO Dim strDriveLetter>> RCd.vbs ECHO Dim intDriveLetter>> RCd.vbs ECHO Dim fs 'As Scripting.FileSystemObject>> RCd.vbs ECHO Const CDROM = 4>> RCd.vbs ECHO On Error Resume Next>> RCd.vbs ECHO Set fs = CreateObject("Scripting.FileSystemObject")>> RCd.vbs ECHO strDriveLetter = "">> RCd.vbs ECHO For intDriveLetter = Asc("A") To Asc("Z")>> RCd.vbs ECHO Err.Clear>> RCd.vbs ECHO If fs.GetDrive(Chr(intDriveLetter)).DriveType = CDROM Then>> RCd.vbs ECHO If Err.Number = 0 Then>> RCd.vbs ECHO strDriveLetter = Chr(intDriveLetter)>> RCd.vbs ECHO Exit For>> RCd.vbs ECHO End If>> RCd.vbs ECHO End If>> RCd.vbs ECHO Next>> RCd.vbs ECHO Set ts = fs.CreateTextFile(Left(Wscript.ScriptFullName, InstrRev(Wscript.ScriptFullName, ".")) ^& "cmd", True, False)>> RCd.vbs ECHO ts.WriteLine "set " ^& Left(WScript.ScriptName, InStr(WScript.ScriptName, ".") - 1) ^& "=" ^& strDriveLetter>> RCd.vbs ECHO ts.CloseECHO.ECHO Getting The Cd Letter......%R3%start wscript.exe RCd.vbs%R2%del RCd.vbscall RCd.cmddel RCd.cmdcls%Size3%color 7bECHO Your Cd Is %RCD%ECHO.SET cdrom=%RCD%%R1% SET CDS=%CDROM%\Apps\mode con: cols=55 lines=3SET D=%CDROM%\Apps\%R0% Title Varible 1ECHO.ECHO %CDS%%R3% clsTitle Varible 2ECHO.ECHO %D%ECHO Completed%R3%GOTO Software:Menu3:MRDCLS%Size7%COLOR 2fTITLE LETS MAKE A DIRECTORY? SET S9=Space(9)SET Menu6T1=Would You Like To Run This AgainSET S5=Space(5) > Mini1.vbs ECHO %UI% = Msgbox(%S5% ^& "MAKE OR DELETE A FOLDER" ^& %V% ^& "%Menu6T1%" ^& %V% ^&_>> Mini1.vbs echo "%T6% To Re Run Make And Delete" ^& %V% ^& "%T7% To Return To Main",vbyesno + 64,"Mini1") >> Mini1.vbs echo If %UI% = vbYes then>> Mini1.vbs echo Set fs = CreateObject("Scripting.FileSystemObject") >> Mini1.vbs echo %FN% = fs.BuildPath(Wscript.ScriptFullName ^& "\..", "Mini1.cmd") >> Mini1.vbs echo %FN% = fs.GetAbsolutePathName(strFileName) >> Mini1.vbs echo Set ts = fs.%OTF%(strFileName, 2, True) >> Mini1.vbs echo ts.WriteLine "set Mini1=" ^& %UI% >> Mini1.vbs echo ts.Close>> Mini1.vbs echo End If>> Mini1.vbs echo If %UI% = vbno then>> Mini1.vbs echo Set fs = CreateObject("Scripting.FileSystemObject") >> Mini1.vbs echo %FN% = fs.%BP%(Wscript.ScriptFullName ^& "\..", "Mini1.cmd") >> Mini1.vbs echo %FN% = fs.%GAP%(strFileName) >> Mini1.vbs echo Set ts = fs.%OTF%(strFileName, 2, True) >> Mini1.vbs echo ts.%WL% "echo off">> Mini1.vbs echo ts.%WL% "cls">> Mini1.vbs echo ts.%WL% "set Mini1=" ^& %UI%>> Mini1.vbs echo ts.Close>> Mini1.vbs echo End If > MKDel.vbs echo On Error Resume Next>> MKDel.vbs echo dim Ed, Foldername, Folder, name, result, shFolder, shFolderItem, subFolder, subFolders >> MKDel.vbs echo Dim shFile, s***em, CADObject, appName, wsShell, shellApp, fso >> MKDel.vbs echo Text1 = "Will It Be This: ">> MKDel.vbs echo Text2 = "Is This Correct: ">> MKDel.vbs echo Text3 = "Where Is This: ">> MKDel.vbs echo Text4 = "Press NO To Keep File Made" ^& %V% ^& "Press YES To DELETE The Folder?">> MKDel.vbs echo Text5 = %S9% ^&"NO TO KEEP" ^& %S5% ^& "YES TO DELETE?">> MKDel.vbs echo Set wsShell = %COW%>> MKDel.vbs echo Set shellApp = %COT%>> MKDel.vbs echo Set fso = CreateObject("Scripting.FolderSystemObject")>> MKDel.vbs echo Set shFolder = shellApp.BrowseForFolder(0, "To Keep The Folder, At The Next Box %T7% To Keep It? " ^&_>> MKDel.vbs echo " Or %T6% To Delete Any Folder" ^& %V% ^& "IMPORTANT THIS WILL DELETE WHOLE DIRECTORIES", 2) >> MKDel.vbs echo Set shFolderItem = shFolder.Items.Item>> MKDel.vbs echo Set Folder = fso.GetFolder(DisplayInformation (Foldername))>> MKDel.vbs echo Set CADObject = GetObject(file)>> MKDel.vbs echo On Error Resume Next ' Catch cancel (if BrowseForFolder) and invalid paths>> MKDel.vbs echo If WScript.Arguments.Count = 0 Then>> MKDel.vbs echo Foldername = shFolderItem.Path>> MKDel.vbs echo Foldername = WScript.Arguments(0)>> MKDel.vbs echo Foldername = msgbox("Argument Box Reply"^& %V% ^&"" ^& Arguments ^& vbyesno (0)("WhatsUp"))>> MKDel.vbs echo Else>> MKDel.vbs echo End If>> MKDel.vbs echo Ed = msgbox ("" ^& Text2 ^& "" ^& %V% ^& Foldername ^& %V% ^& Text4,vbyesno+48,text5 ^&"")>> MKDel.vbs echo if ed = vbyes then>> MKDel.vbs echo On Error Goto 0>> MKDel.vbs echo Dim Garbage >> MKDel.vbs echo set Garbage = (CreateObject("Scripting.FileSystemObject"))>> MKDel.vbs echo msgbox "Starting Clean UP?",vbokonly+48,"Clean Up">> MKDel.vbs echo wscript.sleep 500>> MKDel.vbs echo Garbage.DeleteFolder "" ^& Foldername>> MKDel.vbs echo Delete="" ^& Foldername >> MKDel.vbs echo msgbox "Clean up Completed?",vbokonly+48,"Files Are Removed??">> MKDel.vbs echo if ed = vbno then>> MKDel.vbs echo On Error Goto 0>> MKDel.vbs echo ed = msgbox ("We Are Going Back To Main", 0 + 48, "GOING BACK TO MAIN")>> MKDel.vbs echo wscript.quit>> MKDel.vbs echo else>> MKDel.vbs echo end if>> MKDel.vbs echo else>> MKDel.vbs echo end if %Size7%echo.ECHO You Can Make A Folder Or Delete A FolderECHO This Script Generates The Built InECHO Brows For VBS Function. All Right Click, ECHO Functions Work ON This.ECHO IMPORTANT THIS WILL DELETE WHOLE DIRECTORIES???start /w MKDel.vbsSet /p = Lets Continue On With The Demo:MiniLoop1color 4fclscolor 2bTitle Lets Make A Choiceecho.echo Processing..........start /w Wscript.exe Mini1.vbscall Mini1.cmd %Rst1%del Mini1.cmdgoto %Mini1%:REDO1color 4fclscolor 2bTitle Lets start /w MKDel.vbsecho.SET /P = Yes To Continue No To Return To Mainstart /w Wscript.exe Mini1.vbscall Mini1.cmd %Rst1%del Mini1.cmdgoto %Mini1%:6cls%Size7%color f4Title This Box Keeps It In This Loop %R0%echo.echo This Is My Make A Folder Or Delete A Folderecho This is A Mini-Loop It Servers As A echo Crude Error Control.echo.echo This Script Demo A Vbs Make Delete Or Keepecho.echo USE CAUTION USING THIS FOR IT WILL DELETE echo WHOLE DIRECTORIES. SET /P = LETS MAKE MORE OR DELETE MOREgoto REDO1:7clscolor 5e%Size7%Title This Box Returns You To Mainecho.echo This Is The Second Reply Choiceecho When This Cmd Closes You Will Return echo Main Menu.echo This Script Demo A Vbs Make Delete Or Keepecho.del Mini1.vbsdel MKDel.vbs %R4%goto Software:Menu4:TXTcls%Size11%color f2TITLE PRODUCE A SIMPLE CMD FILEECHO. > RtxtD.vbs echo Dim fso, MyFile, MyFile1, MyIn0, MyIn1, MyIn2, MyIn3>> RtxtD.vbs echo Set sh = CreateObject("WScript.Shell")>> RtxtD.vbs echo Set fso = CreateObject("Scripting.FileSystemObject")>> RtxtD.vbs echo Set oWS = WScript.CreateObject("WScript.Shell")>> RtxtD.vbs echo Set fso = CreateObject("Scripting.FileSystemObject")>> RtxtD.vbs echo MyIn0 = InputBox(space(15)^&"Gsm Make A Cmd" ^& %V% ^&"This Box Gives The Cmd A Name" ^& %V% ^&"","Gsm Input Text","MYCMD",10555,5300)>> RtxtD.vbs echo MyIn1 = InputBox(space(5)^&"Gsm Make A Cmd" ^& %V% ^&_>> RtxtD.vbs echo "This Will Set The Size Of The Cmd Window " ^& %V% ^&"Going Left to Right"^& Vbnewline^&_>> RtxtD.vbs echo "Exmplales"^&vbnewline^&"1\ cols= 55"^&vbnewline^&"1\ cols= 45"^&vbnewline^&_>> RtxtD.vbs echo "Try to Keep the Number Between 40 and 105","Your Cmd Name","45",10555,5300)>> RtxtD.vbs echo MyIn2 = InputBox("Gsm Make A Cmd " ^& %V% ^&"This Will Set The Size Of The Cmd Window" ^& %V% ^&"Going Top to Bottom","Cmd Windows Hieght","4",10555,5300)>> RtxtD.vbs echo MyIn3 = InputBox("Gsm Make A Cmd " ^& %V% ^&"This Will Set The BackGround And Text Color Of The Cmd Window" ^& %V% ^&"Examples f2, 9f, b2, 7f, 5e" ^&vbNewLine ^&_>> RtxtD.vbs echo "","Cmd Windows Background Colors","f2",9555,4800)>> RtxtD.vbs echo Set MyFile = fso.CreateTextFile(MyIn0^&".cmd", True)>> RtxtD.vbs echo MyFile1 = Inputbox("Type A Responce In To Add To The Cmd" ^& %V% ^& "This Will Be Echo Back On A New Cmd Window?","Gsm","GSM I DID THIS!")>> RtxtD.vbs echo MyFile.WriteLine("Echo Off")>> RtxtD.vbs echo MyFile.WriteLine("mode con: cols="^&MyIn1^& "lines=")^&MyIn2>> RtxtD.vbs echo MyFile.WriteLine("Color ")^&MyIn3>> RtxtD.vbs echo MyFile.WriteLine("echo ")^&MyFile1>> RtxtD.vbs echo MyFile.WriteLine("ping -n 4 127.0.0.1>nul")>> RtxtD.vbs echo MyFile.WriteLine("echo.")>> RtxtD.vbs echo MyFile.WriteLine("exit.")>> RtxtD.vbs echo MyFile.Close>> RtxtD.vbs echo Tmp1=msgbox ("Your Cmd Name Is:" ^& %V% ^& MyIn0 ^& ".CMD" ^& %V% ^&_>> RtxtD.vbs echo %V% ^& "Your CMD Windows Size:" ^& %V% ^& "mode con: cols="^& MyIn1 ^& space(1) ^& "lines="^& MyIn2 ^& %V% ^&_>> RtxtD.vbs echo "The Cmd Windows Colors: " ^& MyIn3 ^& %V% ^& "You Will See this Message In The Cmd Window:" ^& %V% ^& MyFile1 ^&"",vbokonly+48,"HERE YOUR CMD?")>> RtxtD.vbs echo Wscript.sleep(500) >> RtxtD.vbs echo ''''''''''''''''''''''WHERE I WILL MAKE A USER SELECTION>> RtxtD.vbs echo msgbox "Continue",vbokonly+48,"Hello And Good-Day">> RtxtD.vbs echo sh.run(MyIn0^&".cmd") >> RtxtD.vbs echo wscript.sleep 250>> RtxtD.vbs echo msgbox "Press Button To Close This"^& %V% ^&"And Kill The Cmd",vbokonly+48,"Deleting">> RtxtD.vbs echo wscript.sleep 2000>> RtxtD.vbs echo Set MyFile = fso.GetFile(MyIn0^&".cmd") >> RtxtD.vbs echo wscript.sleep 750>> RtxtD.vbs echo MyFile.Deleteecho.ECHO Here Where We Will Make ECHO A Simple Cmd With What You Input In The Next Boxes ECHO NAME A box Will Pop-up Fill In The A Name ECHO SIZE This Box Allows You To Set The Width Of Cmd WindowECHO Hieght This Box Sets The Hieght Of The Cmd WindowECHO COLOR This Sets The Background And Text ColorECHO MESSAGE What You Will See On The New Cmd Screen%R4%start /w RtxtD.vbsSet /p = Lets Continue On With The Demodel RtxtD.vbsGOTO Software:: Menu1, Menu2, Menu3, Menu4, Menu5 ARE THE SPOTS IN THE BATCH FILE WHERE WE GOTO FROM SOFTWARE ::THAN WE GOTO SOFTWARE FROM Menu1, Menu2, Menu3, Menu4, Menu5:Menu5RUNclsmode con: cols=60 lines=29TITLE GSM RUN1 MAKER! > R1MKGSM.vbs echo DIM inti, inty, intB, intC ,Desktop>> R1MKGSM.vbs echo Dim fso, MyFile, f, ts, WF, Z1, Msg1, Msg2, Msg3, Msg4, Msg5, Msg6, Msg7>> R1MKGSM.vbs echo Msg1 = "MENU AND INSTALL LOCATION">> R1MKGSM.vbs echo Msg2 = "Type A Name That Will Appear On The Install Part Of The Setup">> R1MKGSM.vbs echo Msg3 = "This Also Server As The Install Location, That Windows Will Look For During The Install Phase">> R1MKGSM.vbs echo Msg4 = "INSTALL ORDER AND SWITCHES">> R1MKGSM.vbs echo Msg5 = "Type the Install Switches To Install With.">> R1MKGSM.vbs echo Msg6 = "This Is Where You Will Add The Cmd For Silent Installs. You Will Need The Proper Switches To Work!">> R1MKGSM.vbs echo Msg7 = "For More Information Please Go" ^& Vbcrlf ^& space(12) ^&_>> R1MKGSM.vbs echo chr(174) ^&" To WWW.MSFN.ORG" ^& chr(174) ^& Vbcrlf ^&_>> R1MKGSM.vbs echo "They Have Many good References There For Switches And Information On The Unattended Install.">> R1MKGSM.vbs echo Const ForReading = 1, ForWriting = 2, ForAppending = 8>> R1MKGSM.vbs echo Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0>> R1MKGSM.vbs echo Set sh = CreateObject("WScript.Shell")>> R1MKGSM.vbs echo Set fso = CreateObject("Scripting.FileSystemObject")>> R1MKGSM.vbs echo Set oWS = WScript.CreateObject("WScript.Shell")>> R1MKGSM.vbs echo Set fso = CreateObject("Scripting.FileSystemObject")>> R1MKGSM.vbs echo Set WF = fso.OpenTextFile("\RunOnceEx.cmd", ForWriting, 2)>> R1MKGSM.vbs echo WF.WriteLine "cmdow @ /HID">> R1MKGSM.vbs echo WF.WriteLine "@echo off">> R1MKGSM.vbs echo WF.WriteBlankLines 1>> R1MKGSM.vbs echo WF.WriteLine "for %%i in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do if exist %%i\SETUP.exe set CDROM=%%i">> R1MKGSM.vbs echo WF.WriteBlankLines 1>> R1MKGSM.vbs echo WF.WriteLine "SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx">> R1MKGSM.vbs echo WF.WriteBlankLines 1>> R1MKGSM.vbs echo WF.WriteLine "REG ADD %KEY% /V TITLE /D ""The Install Section"" /f">> R1MKGSM.vbs echo WF.WriteBlankLines 1>> R1MKGSM.vbs echo WF.WriteLine "REG ADD %KEY%\000 /VE /D ""Preparing Installation..."" /f">> R1MKGSM.vbs echo WF.WriteBlankLines 1>> R1MKGSM.vbs echo WF.close>> R1MKGSM.vbs echo on error resume next>> R1MKGSM.vbs echo Dir1 = "%%systemdrive%%\INSTALL\">> R1MKGSM.vbs echo inti = 11>> R1MKGSM.vbs echo inty = 10 + 2>> R1MKGSM.vbs echo intB = 1 - 1 >> R1MKGSM.vbs echo DO>> R1MKGSM.vbs echo inti = + 2 >> R1MKGSM.vbs echo inty = inty + inti >> R1MKGSM.vbs echo intB = intB + inti -1 >> R1MKGSM.vbs echo MN = Inputbox(Msg1 ^& vbcrlf ^& Msg2 ^& vbcrlf ^& Msg3 ,"How Many Apps="^& intB ,"TYPE THE REPLY HERE")>> R1MKGSM.vbs echo INSTall = Inputbox(Msg4 ^& vbcrlf ^& Msg5 ^& vbcrlf ^& Msg6^& vbcrlf ^& Msg7 ,"How Many Apps="^& intB ,"TYPE THE REPLY HERE")>> R1MKGSM.vbs echo inti = Msgbox ("Yes To Add More" ^& vbcrlf^& "The RunOnce Line Added" ^& vbcrlf ^& "REG ADD %KEY%%\0" ^&inty ^& vbcrlf ^& vbcrlf ^&_>> R1MKGSM.vbs echo "No To Quit This",vbyesno+64,"How Many Apps="^& intB)>> R1MKGSM.vbs echo if inti = 6 then>> R1MKGSM.vbs echo Set sh = CreateObject("WScript.Shell")>> R1MKGSM.vbs echo Set fso = CreateObject("Scripting.FileSystemObject")>> R1MKGSM.vbs echo Set oWS = WScript.CreateObject("WScript.Shell")>> R1MKGSM.vbs echo Set fso = CreateObject("Scripting.FileSystemObject")>> R1MKGSM.vbs echo Set WF = fso.OpenTextFile("\RunOnceEx.cmd", ForAppending, 8)>> R1MKGSM.vbs echo WF.WriteLine "REG ADD %KEY%\0" ^& inty ^& " /VE /D """ ^& MN ^& " /f">> R1MKGSM.vbs echo WF.WriteLine "REG ADD %KEY%\0" ^& inty ^& " /V 1 /D ""%%systemdrive%%\INSTALL\" ^& MN ^& "\" ^& INSTall ^& """ /f">> R1MKGSM.vbs echo WF.WriteBlankLines 1 >> R1MKGSM.vbs echo End If>> R1MKGSM.vbs echo if inti = 7 then>> R1MKGSM.vbs echo Set sh = CreateObject("WScript.Shell")>> R1MKGSM.vbs echo Set fso = CreateObject("Scripting.FileSystemObject")>> R1MKGSM.vbs echo Set oWS = WScript.CreateObject("WScript.Shell")>> R1MKGSM.vbs echo Set fso = CreateObject("Scripting.FileSystemObject")>> R1MKGSM.vbs echo Set WF = fso.OpenTextFile("\RunOnceEx.cmd", ForAppending, 8)>> R1MKGSM.vbs echo WF.WriteLine "REG ADD %KEY%\0" ^& inty ^& " /VE /D """ ^& MN ^& " /f">> R1MKGSM.vbs echo WF.WriteLine "REG ADD %KEY%\0" ^& inty ^& " /V 1 /D ""%%systemdrive%%\INSTALL\" ^& MN ^& "\" ^& INSTall ^& """ /f">> R1MKGSM.vbs echo WF.WriteBlankLines 1 >> R1MKGSM.vbs echo WF.WriteLine "REG ADD %KEY%\170 /VE /D ""Preparing Final Clean up ..."" /f">> R1MKGSM.vbs echo WF.WriteLine "REG ADD %KEY%\170 /VE /D ""%%systemdrive%%\INSTALL\Cleanup.exe"" /f">> R1MKGSM.vbs echo WF.close>> R1MKGSM.vbs echo msgbox "Thank-You For Using This" ^& vbcrlf ^& "I Did This!"^& vbcrlf ^& "Gunsmokingman",vbokomly+64,"GOOD-BYE,AND SMILE TO FEEL HAPPY!!!">> R1MKGSM.vbs echo End If>> R1MKGSM.vbs echo Loop Until inti = 7>> R1MKGSM.vbs echo Set WshShell = WScript.CreateObject ("WScript.Shell")>> R1MKGSM.vbs echo Set sh = CreateObject("WScript.Shell")>> R1MKGSM.vbs echo sh.Run ("notepad.exe \RunOnceEx.cmd")>> R1MKGSM.vbs echo Dim Garbage>> R1MKGSM.vbs echo set Garbage = (CreateObject("Scripting.FileSystemObject"))>> R1MKGSM.vbs echo wscript.sleep 750>> R1MKGSM.vbs echo Garbage.DeleteFile ("\R1*.vbs")>> R1MKGSM.vbs echo wscript.sleep 750>> R1MKGSM.vbs echo Delete=("\R1*.vbs")>> R1MKGSM.vbs echo WshShell.Popup "Clean up Completed?", 2,"Files Are Removed?" ,vbokonly+48>> R1MKGSM.vbs echo wscript.sleep 150>> R1MKGSM.vbs echo Wscript.Quitclsmode con: cols=82 lines=30color b0echo.echo My Run1 Templateecho This Only Produces 2 Lines Of A RunOnceEx.cmdecho.ECHO This Will Produces As Many Lines Until You Hit NoECHO This Has 2 Counters One For How Many Apps InstalledECHO The Other Count Starts With This REG ADD %KEY%\014 To REG ADD %KEY%\ Whenever You Say NoECHO If You Go Over 43 Apps Intalled The REG ADD %KEY%\0014 Will Become A 4 Digit NumberECHO Than You Will Have To Edit The Number Back To This Format REG ADD %KEY%\114ECHO The RunonceEx.cmd Is Located In %SD%echo.echo LINES IT WILL MAKEecho REG ADD %KEY%\014 /VE /D "TYPE THE REPLY HERE" /fecho REG ADD %KEY%\014 /V 1 /D "%systemdrive%\INSTALL\TYPE THE REPLY HERE\TYPE THE REPLY HERE" /fecho.echo LINES IT WILL NOT MAKE echo REG ADD %KEY%\015 /VE /D "Alcohol120" /fecho REG ADD %KEY%\015 /V 1 /D "REGEDIT /S %systemdrive%\INSTALL\Alcohol\TestAlcohol.reg" /fecho REG ADD %KEY%\015 /V 2 /D "%systemdrive%\INSTALL\Alcohol\setup.msi /qb/promtrestart" /f echo.echo THE FIX TO ADD REGISTRY AND EXTRA ENTRIESecho REG ADD %KEY%\014 /VE /D "Alcohol120 REG" /fecho REG ADD %KEY%\014 /V 1 /D "REGEDIT /S %systemdrive%\INSTALL\Alcohol\TestAlcohol.reg" /fecho.echo REG ADD %KEY%\016 /VE /D "Alcohol120" /fecho REG ADD %KEY%\016 /V 1 /D "%systemdrive%\INSTALL\Alcohol\setup.msi /qb/promtrestart" /fecho. Set /p = Lets Continue On With The Demostart /w R1MKGSM.vbs%R1%del R1MKGSM.vbsdel R*.vbsGOTO Software:endcls%Size3%color a9TITLE MENU THE ENDECHO.ECHO Here The End Clean Up Time?%R3%ping -n 1 127.0.0.1>nuldel Rst*.vbsEXIT Edited July 18, 2005 by gunsmokingman Link to comment Share on other sites More sharing options...
JoeMSFN Posted July 8, 2005 Share Posted July 8, 2005 (edited) I also remember reading somwhere that .cmd files use "cmd.exe" where .bat files use "command.exe". "cmd.exe" seems to let you do all the nifty extras included with the NT series of batch/command scripting, where "command.exe" appears to be quite limiting (i.e. only original DOS stuff can be performed).Just do a google search for cmd vs command and you'll see.First lesson.. it's no longer called "batch script" it's "command script" and technically you should use the extension .cmd instead of .bat. BAT is only for backwards compatability.<{POST_SNAPBACK}> Edited July 8, 2005 by JoeMSFN Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now