evilvoice Posted August 23, 2004 Posted August 23, 2004 Ok, now normally I would post this in the topic it sorta belongs in, but my question doesnt pertain to the part of the batch file that the topic talks about...This is the scenario...I would like to be able to add a variable for 2cd install within the multiple runonceex.cmd batch...this is what I have so farcall common.cmdIf /I %computername%==Computer GOTO Comp1If /I NOT %computername%==Computer GOTO Comp2:Comp1call Comp1.cmdGOTO END:Comp2call Comp2.cmdGOTO END:ENDstart process.exe -q cmd.exe 120set /p Install="For a 2cd setup, Press Y"If %Install%==Y CALL 2cd.cmdECHO DoneOk now for whats going wrong...process, which is supposed to wait 120 seconds to kill the cmd window, does not wait. I would like to be able to plug something in that if I do not hit "Y" at that time, that it will exit the batch and continue with installation at some point...or can I add runonceex variables at t-39? since I am using detachedprogram to set up users...which, btw, I have a question for raverod, if he reads this...what is this?echo. > %systemdrive%\MSA\%NewAdmin% I mean why do you have that line in there? I am wondering because I need to know if I need to change something with my OEM folder for your usersetup.bat to work...I changed the MSA\Utilities locations to correspond with my own, and Im thinking about deleting the remoteadmin part
sleepnmojo Posted August 23, 2004 Posted August 23, 2004 what is this?CODE echo. > %systemdrive%\MSA\%NewAdmin% I mean why do you have that line in there? I am wondering because I need to know if I need to change something with my OEM folder for your usersetup.bat to work...I changed the MSA\Utilities locations to correspond with my own, and Im thinking about deleting the remoteadmin partThat is used to echo an empty line.in your two IF statements at the top, just use an else, no point in using two there.As for the main portion of your question, could you post process, or explain where to get it, so we can see how it is used.
evilvoice Posted August 23, 2004 Author Posted August 23, 2004 process can be found here...thank you for the comment on else...I was thinking about that, but was not 100% sure if it would work that wayActually I know what echo does...but where does it put an empty line, and why?
jdoe Posted August 23, 2004 Posted August 23, 2004 If you can't make it work with process.exe there's a way to do it (a little tricky but it work) - you need sleep.exe and cmdow.exeSLEEP.EXE and CMDOW.EXETITLE WindowToCloseECHO SLEEP.EXE 120>>%WINDIR%\CLOSE.CMDECHO CMDOW.EXE WindowToClose /CLS>>%WINDIR%\CLOSE.CMDECHO DEL /F /Q %WINDIR%\CLOSE.CMD>>%WINDIR%\CLOSE.CMDcall common.cmdIf /I %computername%==Computer GOTO Comp1If /I NOT %computername%==Computer GOTO Comp2:Comp1call Comp1.cmdGOTO END:Comp2call Comp2.cmdGOTO END:ENDSTART %WINDIR%\CLOSE.CMDset /p Install="For a 2cd setup, Press Y"If %Install%==Y CALL 2cd.cmdECHO DoneI have not test it but why it shouldn't work...To print an empty line in a file ECHO. in enoughECHO.>FILE.TXTHope this help
evilvoice Posted August 23, 2004 Author Posted August 23, 2004 I musta not explained about the echo....echo. > %systemdrive%\MSA\%NewAdmin%Why does this command exist...this would be better for raverod since its his command...if someone does know why it exists in usersetup.cmd/bat then by all means comment, but I do know how to use echo and how to store text in a file from dos/command window, so please, lets not reply with telling me how to do it...I wanna know why it exists.PS. thank you for the reply jdoe...will test in a secOk update...cmdow does close the window, very cool...but it doesnt close the "close.cmd" window at the end...will test by adding EXIT to the end of the creation of close.cmd
jdoe Posted August 23, 2004 Posted August 23, 2004 I'm a little surprise that the close.cmd window is not closing automatically but adding EXIT at the end is a good idea.Like I said, a little tricky but it seem to work
jdoe Posted August 23, 2004 Posted August 23, 2004 It's just too bad that it takes 2 EXE to do it. There must be a single program for that somewhere. We just don't know where it is hidden.. B)
evilvoice Posted August 23, 2004 Author Posted August 23, 2004 now without sleep.exeTITLE WindowToCloseECHO setlocal ENABLEEXTENSIONS & set n=120 > %WINDIR%\CLOSE.CMDECHO ping -n %n% 127.0.0.1 >nul >> %WINDIR%\CLOSE.CMDECHO CMDOW.EXE WindowToClose /CLS >> %WINDIR%\CLOSE.CMDECHO endlocal >> %WINDIR%\CLOSE.CMDECHO DEL /F /Q %WINDIR%\CLOSE.CMD >> %WINDIR%\CLOSE.CMDECHO EXIT >> %WINDIR%\CLOSE.CMDcall common.cmdIf /I %computername%==Computer GOTO Comp1 ELSE GOTO Comp2:Comp1call Comp1.cmdGOTO END:Comp2call Comp2.cmdGOTO END:ENDSTART %WINDIR%\CLOSE.CMDset /p Install="For a 2cd setup, Press Y"If %Install%==Y CALL 2cd.cmdECHO DoneI noticed another post talking about ping, but I found this on the webpage for the creator of cmdow...I just used the pertinent info from it. I would like to know how to get this into the cmd file correctlyECHO ping -n %n% 127.0.0.1 >nul >> %WINDIR%\CLOSE.CMDAnother thing, everytime I run the cmd file, it says it cannot find close.cmd when deleting...any idea why? It does delete the file, but I just wanna know how to get rid of that message.
jdoe Posted August 24, 2004 Posted August 24, 2004 I have tried to get the same message (cannot find close.cmd) but I can'tHave you tried without enableextensions... like this...TITLE WindowToCloseECHO ping -n 120 127.0.0.1 >nul >> %WINDIR%\CLOSE.CMDECHO CMDOW.EXE WindowToClose /CLS >> %WINDIR%\CLOSE.CMDECHO DEL /F /Q %WINDIR%\CLOSE.CMD >> %WINDIR%\CLOSE.CMDECHO EXIT >> %WINDIR%\CLOSE.CMDcall common.cmdIf /I %computername%==Computer GOTO Comp1 ELSE GOTO Comp2:Comp1call Comp1.cmdGOTO END:Comp2call Comp2.cmdGOTO END:ENDSTART %WINDIR%\CLOSE.CMDset /p Install="For a 2cd setup, Press Y"If %Install%==Y CALL 2cd.cmdECHO Done
sleepnmojo Posted August 24, 2004 Posted August 24, 2004 Give this a try. This should fix your problem with the ping > nul, what it is actually doing is trying to redirect, so you need the ^ in there to stop. I haven't tested this, so there is no guarantee on it.TITLE WindowToClose( ECHO setlocal ENABLEEXTENSIONS & set n=120 ECHO ping -n %n% 127.0.0.1 ^>nul ECHO CMDOW.EXE WindowToClose /CLS ECHO endlocal ECHO DEL /F /Q %WINDIR%\CLOSE.CMD ECHO EXIT) > %WINDIR%\CLOSE.CMDcall common.cmdIf /I %computername%==Computer GOTO Comp1 ELSE GOTO Comp2:Comp1call Comp1.cmdGOTO END:Comp2call Comp2.cmdGOTO END:ENDSTART %WINDIR%\CLOSE.CMDset /p Install="For a 2cd setup, Press Y"If %Install%==Y CALL 2cd.cmdECHO Done
gunsmokingman Posted August 24, 2004 Posted August 24, 2004 ping -n 1 127.0.0.1>nultake out the space and that should end the problemthat the way I have been doing it and havn't seen a errorand the 1 after the -n is for One second
evilvoice Posted August 24, 2004 Author Posted August 24, 2004 gunsmokingman, the problem is that using echo to store the line in another file is what causes an error...I forget how to pull up what is allowed for using ">"'s, but you are not able to just simply >nul >close.cmd, now I havent tried your method, but it seems you are running that at commandline and not actually ECHO'ing it to another file to run, so I may be wrong.I would like to say thank you to everyone...finally got what seems to be a working version...used both sleepnmojo and jdoe combined...for some reason the %n% of sleepnmojo's wouldnt store in the file, and using jdoes idea of cleaning stuff which I dont need, like set n, set and endlocal.So here it is finished...still cannot get it to delete without error, always comes back with cannot find...But what this batch file does is to use multiple runonceex.cmd's and allow for a 2cd install, where 2cd.cmd contains the runonceex.cmd settings for the 2nd cd, and if youve looked at the multiple runonce thread, you should know the other part of the cmd file...TITLE WindowToClose( ECHO ping -n 120 127.0.0.1 ^>nul ECHO CMDOW.EXE WindowToClose /CLS ECHO EXIT) > %WINDIR%\CLOSE.CMDcall common.cmdIf /I %computername%==Computer GOTO Comp1 ELSE GOTO Comp2:Comp1call Comp1.cmdGOTO END:Comp2call Comp2.cmdGOTO END:ENDSTART %WINDIR%\CLOSE.CMDset /p Install="For a 2cd setup, Press Y"If %Install%==Y CALL 2cd.cmdECHO DoneEXITAttached is the cmd window with the error...
Denney Posted August 24, 2004 Posted August 24, 2004 what is this?echo. > %systemdrive%\MSA\%NewAdmin%That my friend, is my way of telling another cmd file which user we are installing for.Seeing as I couldn't work out global variables that can be used in another batch file, I've made my batch file create an empty (echo.) file name the name of the user I'm installing this for.Later on in the installation, in another batch file, I can test to see which user I am installing Windows for.I use it to import user-based registry edits mainly and because I'm only doing a few computers with this particular CD, I can have my command files check which PC I'm installing it on.Also helps for when I install an application like Visual Studio that I use by no-one else in the house does. I just have the cmd file that install Visual Studio check for a file named "RaveRod" in the MSA directory.Hope that straightens things out for you.
evilvoice Posted August 24, 2004 Author Posted August 24, 2004 Ah HA! thats actually really cool...i may have to put that in my global "things to do with cd before creating cd" file...which lists everything I need to do before I burn the finished product.
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