I've dug thru the group for an answer to what is probably simple
but I've not quite got the hang of the %1 part of what I want to do.
Using about 150 Win98 OS Systems and 300+ WinXP systems. It doesn't
matter if I need to use GAWK or GREP etc. I've gone beyond pure
.BATch, too many needs to hope for such luxury.
Basically, I have just setup switches for my program that allow the
user (or me) to run /HELP /LOCAL or /DEBUG modes to the program.
For now I would be the only one using these switches and I know
enough that I will use the CAPSLOCK to enter these switches.
I have setup the /HELP with most ways to type and still work.
::+=(HELP)=====================+::
@IF "%1"=="/HELP" GOTO :_HELP_SCR
@IF "%1"=="/help" GOTO :_HELP_SCR
@IF "%1"=="/Help" GOTO :_HELP_SCR
@IF "%1"=="-HELP" GOTO :_HELP_SCR
@IF "%1"=="-Help" GOTO :_HELP_SCR
@IF "%1"=="-help" GOTO :_HELP_SCR
@IF "%1"=="HELP" GOTO :_HELP_SCR
@IF "%1"=="Help" GOTO :_HELP_SCR
@IF "%1"=="help" GOTO :_HELP_SCR
@IF "%1"=="?" GOTO :_HELP_SCR
@IF "%1"=="/?" GOTO :_HELP_SCR
@IF "%1"=="-?" GOTO :_HELP_SCR
::+=(/HELP)====================+::
So I can put in most any /help /hELP -HELP, and it will give the proper
screen. But I'd like to be able to do somewhat of the same thing for
the /DEBUG and /LOCAL.
With the help it is easy as there is only one screen. With the /DEBUG I
use this to turn on the comments to the screen that I don't want the
user to have to see if they happen to watch it run (4:30am).
::+=(DEBUG)====================+::
[01]@IF "%1"=="/debug" SET %1=/DEBUG
[02]@IF "%1"=="/Debug" SET /DEBUG=%1
[03]@IF "%1"=="/dEBUG" SET %1=/DEBUG
[04]@IF "%1"=="?debug" SET D=/DEBUG
[05]@IF "%1"=="?Debug" GOTO :_Wrong
[06]@IF "%1"=="?dEBUG" GOTO :_Wrong
[07]@IF "%1"=="?DEBUG" GOTO :_Wrong
[08]@IF "%1"=="debug" GOTO :_Wrong
[09]@IF "%1"=="Debug" GOTO :_Wrong
[10]@IF "%1"=="dEBUG" GOTO :_Wrong
[11]@IF "%1"=="DEBUG" GOTO :_Wrong
::+=(/DEBUG)===================+::
@ECHO %1
If the user enters /debug, I was hoping I could then SET %1 to /DEBUG
but that doesn't seem to work. Line [01]
But they all echo is whatever I put on the command line /debug
I'd like to be able to tell my user over the phone to just
run PROGRAM /debug and not worry if he tries /Debug or debug or -debug
I just want this to go on and run with debug if it is close enough.
I'd rather not have it dump to :_Wrong so the user has to retype
End result being;
if the debug switch is used, it shows the progress w/line number
[12]@IF "%1"=="/DEBUG" ECHO COUNTING RUNS (01)
Or
[13]@IF "%D%"=="/DEBUG" ECHO COUNTING RUNS (01)
I have not yet tried line [13] but I suspect it will work but there
has to be a more correct simple way I am way overlooking ;)
Thanks very much for any help
sKurt
--
The folowing should work in Win98 and XP (untested):
@echo off
set help=off
set debug=off
echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "help">nul
if not errorlevel 1 set help=on
echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find "?">nul
if not errorlevel 1 set help=on
echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "debug">nul
if not errorlevel 1 set debug=on
echo help=%help%
echo debug=%debug%
>Using about 150 Win98 OS Systems and 300+ WinXP systems. It doesn't
>matter if I need to use GAWK or GREP etc. I've gone beyond pure
>.BATch, too many needs to hope for such luxury.
>
>Basically, I have just setup switches for my program that allow the
>user (or me) to run /HELP /LOCAL or /DEBUG modes to the program.
>For now I would be the only one using these switches and I know
>enough that I will use the CAPSLOCK to enter these switches.
Is it possible to use h l and d as parameters for Help, Local, and Debug
modes? It would simplify the coding.
Use something like this so you test for the required parameters and if they
aren't found then echo a syntax screen
@echo off
if %1.==h. goto ...etc
if %1.==l. goto ...etc
if %1.==d. goto ...etc
if %1.==H. goto ...etc
if %1.==L. goto ...etc
if %1.==D. goto ...etc
.
.
.
.
.
goto :syntax
.
.
.
.
:syntax
echo Purpose: this program does abc
echo Syntax:
echo %0 h for help
echo %0 l for local
echo %0 d for debug
pause
goto :end
** Posted from http://www.teranews.com **
>
> Is it possible to use h l and d as parameters for Help, Local, and
> Debug modes? It would simplify the coding.
>
> Use something like this so you test for the required parameters and
> if they aren't found then echo a syntax screen
>
> @echo off
> if %1.==h. goto ...etc
> if %1.==l. goto ...etc
> if %1.==d. goto ...etc
> if %1.==H. goto ...etc
> if %1.==L. goto ...etc
> if %1.==D. goto ...etc
> .
> .
> .
> goto :syntax
> .
> .
> .
> :syntax
> echo Purpose: this program does abc
> echo Syntax:
> echo %0 h for help
> echo %0 l for local
> echo %0 d for debug
> pause
> goto :end
>
> ** Posted from http://www.teranews.com **
I could use H L D as well but I wonder if I would have the same
problems.
perhaps I should just have a one letter switch for ease of use
and that way I would only have to parse for;
PROGRAM H
PROGRAM h
PROGRAM L
PROGRAM l
PROGRAM D
PROGRAM d
would make it much easier, but I was looking for a solution that I
could use with other programs as well.
The use is not for GOTOs it is to be able to display or not display a
line of comments. Or in the case of Local, either use a FTP.GOOGLE.COM
address or if local a 192.168.1.1 address.
I was looking for something like this;
::+=(01)==============+
::| Count script runs |
::+===================+
@IF "%1"=="/DEBUG" ECHO Counting Runs (01)
@IF EXISTs blah blah blah
::+=(02)================+
::| Is program running? |
::+=====================+
@IF "%1"=="/DEBUG" ECHO Is Program Running? (02)
@PV PROGRAM.EXE> blah blah blah
So there is not really a IF %1==/DEBUG GOTO :_something except in the
case of the help screen, a static screen.
more like if %1=/DEBUG Display something on the screen
and if %1 Doesn't == /DEBUG then move on. Don't show
the play by play of the program to the customer on a
regular basis.
so if you run PROGRAM /DEBUG you will have output like;
Counting Runs (01)
Is Program Running? (02)
.
.
.
END of Program (200)
And if you run PROGRAM it just runs and closes the window when it is
finished running, displaying only errors or messages I cannot seem to
hide.
I was able to use what I was trying to do by this means;
@IF "%1"=="/debug" SET D1=/DEBUG
@IF "%1"=="/Debug" SET D1=/DEBUG
@IF "%1"=="/dEBUG" SET D1=/DEBUG
.
.
.
@IF "%1"==-DEBUG" SET D1=/DEBUG
And now the above code reads;
::+=(01)==============+
::| Count script runs |
::+===================+
@IF "%D1%=="/DEBUG" ECHO Counting script runs (01)
and pretty much unless the user does PROGRAM /DeBuG
or some other crazy thing, I think this covers what
I was looking to do.
It just looks too forced and I was hoping for a more
graceful solution.
Thanks for your Help!
sKurt
--
>
>
> The folowing should work in Win98 and XP (untested):
>
>
> @echo off
> set help=off
> set debug=off
>
>[01] echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "help">nul
> if not errorlevel 1 set help=on
>
>[02] echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find "?">nul
> if not errorlevel 1 set help=on
>
>[03] echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "debug">nul
> if not errorlevel 1 set debug=on
>
>[04] echo help=%help%
>[05] echo debug=%debug%
Wow... not even sure where to begin here.
so [01] looks at any switch and does a find for help without caring for
the case of the help so it could be Help hELP HELP HeLp etc., etc.
and if it finds help
[02] is looking for a ? and if it finds that sets help=on
[03] does the same as [01] except using debug
and it sets debug=on
[04][05] not sure where that gets me?
see if my response to Foxidrive makes any sense. I have parsed for
most of the mistakes one would make /dEBUG ?dEBUG /debug etc., etc.
With your method, would that mean I would do?
::+=(01)==============+
::| Count script runs |
::+===================+
@IF debug=on ECHO COUNTING SCRIPT RUNS (01)
@IF EXIST blah blah blah...
I think this is the direction you are pointing me in? It makes better
use of code instead of many lines of
/debug
/Debug
/dEBUG
?debug
?Debug
?dEBUG
?DEBUG
debug
Debug
dEBUG
DEBUG
-debug
-Debug
-dEBUG
-DEBUG
line [01] eleminates all the above parsing for user prompt/input
Thanks, I'll give this a try as well
sKurt
--
>
>
> The folowing should work in Win98 and XP (untested):
>
>
> @echo off
> set help=off
> set debug=off
>
>[01] echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "help">nul
> if not errorlevel 1 set help=on
>
>[02] echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find "?">nul
> if not errorlevel 1 set help=on
>
>[03] echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "debug">nul
> if not errorlevel 1 set debug=on
>
>[04] echo help=%help%
>[05] echo debug=%debug%
I tried the [01] routine and when I run the program
after echo help=%help% it returns
help=on
=ON was unexpected at this time.
Must have missed something.
Thanks
sKurt
--
There must be an extraneous line in your batch file after the echo.
This worked exactly as advertised for me ...
@echo off
set help=off
echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "help">nul
if not errorlevel 1 set help=on
echo help=%help%
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
>@IF "%D1%=="/DEBUG" ECHO Counting script runs (01)
>
>
>and pretty much unless the user does PROGRAM /DeBuG
>or some other crazy thing, I think this covers what
>I was looking to do.
>
>It just looks too forced and I was hoping for a more
>graceful solution.
This may help. I'm not sure what you want to do with LOCAL but it can
be added easily.
@echo off
(set D1=)
echo %* |findstr /i "help \?" >nul && (echo Syntax: %0 blah &goto:eof)
echo %* |findstr /i "debug" >nul && set D1=DEBUG
>
> This may help. I'm not sure what you want to do with LOCAL but it can
> be added easily.
>
> @echo off
> (set D1=)
> echo %* |findstr /i "help \?" >nul && (echo Syntax: %0 blah &goto:eof)
> echo %* |findstr /i "debug" >nul && set D1=DEBUG
With /LOCAL /Local /local /lOCAL et. al. I was looking to change the
FTP server value from something like FTP.GOOGLE.COM to 192.168.1.100
so that I could test the program locally before sending out group wide.
I'll see what this does, Thanks for the suggestion
sKurt
--
> >
> > --
>
> There must be an extraneous line in your batch file after the echo.
> This worked exactly as advertised for me ...
>
> @echo off
> set help=off
> echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "help">nul
> if not errorlevel 1 set help=on
> echo help=%help%
>
> Tom Lavedas
> ===========
> http://members.cox.net/tglbatch/wsh/
I'll try again, Thanks
sKurt
--
> Basically, I have just setup switches for my program that allow the
> user (or me) to run /HELP /LOCAL or /DEBUG modes to the program.
> For now I would be the only one using these switches and I know
> enough that I will use the CAPSLOCK to enter these switches.
> I have setup the /HELP with most ways to type and still work.
> ::+=(HELP)=====================+::
> @IF "%1"=="/HELP" GOTO :_HELP_SCR
> @IF "%1"=="/help" GOTO :_HELP_SCR
> @IF "%1"=="/Help" GOTO :_HELP_SCR
> @IF "%1"=="-HELP" GOTO :_HELP_SCR
> @IF "%1"=="-Help" GOTO :_HELP_SCR
> @IF "%1"=="-help" GOTO :_HELP_SCR
> @IF "%1"=="HELP" GOTO :_HELP_SCR
> @IF "%1"=="Help" GOTO :_HELP_SCR
> @IF "%1"=="help" GOTO :_HELP_SCR
> @IF "%1"=="?" GOTO :_HELP_SCR
> @IF "%1"=="/?" GOTO :_HELP_SCR
> @IF "%1"=="-?" GOTO :_HELP_SCR
> ::+=(/HELP)====================+::
(Snip)
*** Here's a way to deal with any input at the command line regardless
of case:
SET %1=PARAMETER
IF "%HELP%" == "PARAMETER" GOTO :_HELP_SCR
IF "%-HELP%" == "PARAMETER" GOTO :_HELP_SCR
IF "%/HELP%" == "PARAMETER" GOTO :_HELP_SCR
IF "%/?%" == "PARAMETER" GOTO :_HELP_SCR
IF "%/-?%" == "PARAMETER" GOTO :_HELP_SCR
IF "%//?%" == "PARAMETER" GOTO :_HELP_SCR
Setting the first parameter as an environmental variable will change
its case to upper for this series of tests. It's then a simple matter to
query for differences other than case, as shown above.
> So I can put in most any /help /hELP -HELP, and it will give the proper
> screen. But I'd like to be able to do somewhat of the same thing for
> the /DEBUG and /LOCAL.
> sKurt
*** Substitute each for what I have given.
Richard Bonner
http://www.chebucto.ca/~ak621/DOS/
Analysis correct.
> [04][05] not sure where that gets me?
Well, [04][05] are just to report the result for demo purposes. Putting it
to good use, you would use some IF statements.
[04] if %help%==on goto :help
[05] if %debug%==on goto :debug
Wrapping this up, you need to decide to either post more complete details of
the overall task up front, instead of having us read your responses to
multiple helpers to piece together what you are really after. Note, when you
started this subject you specifically stated this is for Win98 and XP
systms, so the following does not use OS specific commands.
@echo off
echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "help">nul
if not errorlevel 1 goto :help
echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find "?">nul
if not errorlevel 1 goto :help
echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "debug">nul
if not errorlevel 1 goto :debug
set address=%1
if (%1)==() set address=FTP.GOOGLE.COM
echo %1 %2 %3 %4 %5 %6 %7 %8 %9|find /i "local">nul
if not errorlevel 1 set address=192.168.1.1
PROGRAM.EXE %address%
goto :end
:debug
::+=(01)==============+
::| Count script runs |
::+===================+
ECHO Counting Runs (01)
IF EXISTs blah blah blah
::+=(02)================+
::| Is program running? |
::+=====================+
ECHO Is Program Running? (02)
PV PROGRAM.EXE> blah blah blah
goto :end
:HELP
echo Explain what to do here
:end
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
Sorry it is a bit long, but while I was writing a response
to your message, it hit me I could do it like this instead
of 50 lines of every possible way someone could butcher the
/DEBUG switch ;)
This method works where I just look for the word debug
without caring if it is capital or not. And if it is
found, set the variable D1 to /DEBUG or Set L2 to /LOCAL
or if Help is found send it off to the help screen.
I have left the sample code so you can see what I was aiming
for when someone uses the /DEBUG switch.
Thanks for all your suggestions!
Next is CALL XSET32 help...
sKurt
*snip*
::+=(DEBUG)============================+::
[01]@ECHO %1 | FIND /i "debug">NUL
[02]@IF NOT ERRORLEVEL 1 SET D1=/DEBUG
::+=(LOCAL)============================+::
[01]@ECHO %2 | FIND /i "local">NUL
[02]@IF NOT ERRORLEVEL 1 SET L2=/LOCAL
::+====================================+::
::+=(01)=================+
::| Find windows Version |
::+======================+
[01]@ECHON SET j=>tmp$$.bat
::+=(02)===============================+
::| Get Ver, DEL Blanks, Cut out 98/XP |
::+====================================+
[01]@VER | GAWK "/./" | CUT -c 9-10>>tmp$$.bat
[02]@CALL tmp$$.bat>NUL
[03]@DEL tmp$$.bat>NUL
::+=(03)============================+
::| Compare %j% if it is t then set |
::| the variable to XP ELSE it's 98 |
::+=================================+
[01]@IF "%j%"=="t " SET j=XP
::+=(04)=================+
::| Setup XSET OS Switch |
::+======================+
[01]@IF "%j%"=="XP" TITLE SET XSET OS VER
[02]@IF "%D1%"=="/DEBUG" ECHO SET XSET OS (04)
::+==============================+
::| Finally decided to try XSET |
::| and it works great, in Win98 |
::| CALL XSET32 doesn't seem to |
::| work with Windows XP :( |
::+==============================+
[01]@IF "%j%"=="XP" SET X1=CALL XSET32
[02]@IF "%j%"=="98" SET X1=XSET
::+============================+
::| Put the HELP switch AFTER |
::| the XSET parse for color |
::+============================+
::+=(HELP)=====================+::
[01]@ECHO %1 | FIND /i "help">NUL
[02]@IF NOT ERRORLEVEL 1 GOTO :_HELP_SCR
::+=(/HELP)====================+::
::+=(05)==============+
::| Count script runs |
::+===================+
[01]@IF "%D1%"=="/DEBUG" %X1%/COLOR RED /PROMPT "COUNTING RUNS (05)"
[02]@IF EXIST RunCount.DAT GOTO :_1
[03]@>>RunCount.DAT ECHON 0
[04]:_1
[05]@GAWK "{printf \"%%s\n\",$0+1}" RunCount.DAT>count$$$.tmp
[06]@MOVE /Y count$$$.tmp RunCount.DAT>nul
::+=(06)============================+
::| IF PUSHPOS.EXE is running, EXIT |
::+=================================+
[01]@IF "%D1%"=="/DEBUG" %X1%/COLOR CYAN /PROMPT "IS IT RUNNING (06)"
[02]@PV PUSHPOS.EXE >PUSH.DAT
::+=(07)=======================+
::| How many lines in PUSH.DAT |
::| set to variable %v% |
::+============================+
[01]@ECHON set v=>tmp$$.bat
[02]@TYPE PUSH.DAT | GAWK "{print toupper($0)}" | GAWK
"/PUSHPOS.EXE/{n++}; END{print n+0}">>tmp$$.bat
[03]@CALL tmp$$.bat>NUL
[04]@DEL PUSH.DAT>NUL
[05]@DEL tmp$$.bat>NUL
::+=(08)======================================================+
::| IF there is more than 1 line in PUSH.DAT EXIT the program |
::+===========================================================+
[01]@IF NOT %v%==1 GOTO :_TASKOFF
[02]@SET v=
::+=(09)===================================+
::| Test environment for sufficient memory |
::+========================================+
[01]@IF "%D1%"=="/DEBUG" %X1%/COLOR CYAN /PROMPT "TESTING ENVIRON (09)"
[02]@SET
test_=123456789012345678901234567890123456789012345678901234567890
[03]@IF
"%test_%"=="123456789012345678901234567890123456789012345678901234567890
" GOTO :_PROCEED
[04]@Wprompt "ENVIRONMENT ERROR" " Your environment is insufficient!
RESTART YOUR PC TODAY! " OK 1 x
[05]@GOTO :_LoopFail
*snip*
--
Only by reading your code do we see what the debug variable was actually
needed for. Your code is unnecessarily busy. It does a lot that does very
little. Here are a few suggestions.
1) Windows XP has an intrinsic %OS% variable. If all systems are either 98
or XP, then you should only need to check for existence of this variable.
set j=XP
if "%os%=="" set j=98
You could add additional logic if really needed.
2) Since xset does not work on XP, and assuming xset32 operates identically,
I would just rename xset32 to xset on the XP machines and eliminate the need
for the x1 variable.
3) Your test for sufficient environment space on 98 systems is a good idea,
but instructing the user to reboot needs reconsidered. You could easily
restart the batch in 98 with a lager environment by using command/e4096/c%0.
4) Placing an @echo off at the top of the batch eliminates the need for
including an @ on every line of the batch. While your method works fine, it
IMO adds unnecessary clutter to the code.
Unfortunately, there is no clue as to what role PV pushpos.exe plays, but
I'm sure we will seeing something posted on it soon. HTH
> Only by reading your code do we see what the debug variable was
> actually needed for. Your code is unnecessarily busy. It does a lot
> that does very little. Here are a few suggestions.
>
> 1) Windows XP has an intrinsic %OS% variable. If all systems are
> either 98 or XP, then you should only need to check for existence of
> this variable.
>
> set j=XP
> if "%os%=="" set j=98
>
> You could add additional logic if really needed.
>
> 2) Since xset does not work on XP, and assuming xset32 operates
> identically, I would just rename xset32 to xset on the XP machines
> and eliminate the need for the x1 variable.
>
> 3) Your test for sufficient environment space on 98 systems is a good
> idea, but instructing the user to reboot needs reconsidered. You
> could easily restart the batch in 98 with a lager environment by
> using command/e4096/c%0.
>
> 4) Placing an @echo off at the top of the batch eliminates the need
> for including an @ on every line of the batch. While your method
> works fine, it IMO adds unnecessary clutter to the code.
>
> Unfortunately, there is no clue as to what role PV pushpos.exe plays,
> but I'm sure we will seeing something posted on it soon. HTH
It's always good to have the whole picture when asking for help.
I agree, the code is very busy, especially when the program pretty much
is run with no output or bells and whistles. I'm sure I could give you
the code to critique and you would cut it in half! I find something
that works and use it on the rest, then after a while I may find
something else and recode with the new way. ;)
1. I didn't know about the %os% variable, that may pare the code down a
bit more. I use it mostly for the TITLE function that XP uses and some
other misc things.
2. XSET works with 98 and CALL XSET32 doesn't work on Win XP, so at the
moment I am removing all the %X1% variables and using Timo's ECHOC.EXE.
I just tested and it looks like I can remove XSET all together and just
use the ECHOC.EXE program instead. Bonus! Makes for a quicker recode
3. I believe last year you prompted me for the reloading of command.com
and the switch to make the environment bigger on the fly, however, for
some reason it would make the output corrupt, so I removed it. The
users never really see this code run as it happens between 4 and 6 AM
but I do run it from time to time manually when they call in for help.
I have it pop up a message to have them change their environment, but
it is mostly for me to see if it needs to be changed.
4. I tend to agree with you, I have been thinking of removing the @'s
from each line as I go along, and may end up doing it today
And PV.EXE is a command line Process Viewer; pv v 5.2.2.7 by Igor Nys.
http://www.teamcti.com/pview/prcview.htmIn
the instance that you see it, I am checking to see if PUSHPOS.EXE is
running and if it is exit the program so I don't have several instances
running I also use it to check for other programs if they are running,
and it is useful when I need to close a program from the batch. It also
lets me wait for a process to finish before I let the .BATch continue
to the next step pv -x wait until xyz.exe finishes then continue.
Thanks again for your input, always appreciate a hand.
sKurt
--
>2. XSET works with 98 and CALL XSET32 doesn't work on Win XP
Why are you using call with xset32? Does it work without using call?
>
> Why are you using call with xset32? Does it work without using call?
> ** Posted from http://www.teranews.com **
If using Windows XP I try XSET, it gives me the error message that I am
using Win XP and I need to use CALL XSET32 to be able to use the program
XSET.EXE & XSET32.CMD v 5.52
But today I tried XSET.EXE v 5.38 and I think that older version works
correctly and without having to CALL XSET32 like the new version. Hmmm
Using the older version, 5.38, it makes the help screen I created but
after it runs and paints everything correctly, I get two error messages;
The system cannot execute the specified program.
After it already executed it. ??
Found the problem, the command line was over 128 characters (129!) just
missed the correct range. but it is easily fixable.
I'll have to check this avenue as well. The ECHOC.EXE from Timo is
working well at the moment, but I'd still like to use XSET for the help
screen, as it has a pretty interface.
So it looks like XSET may still work, but I have to use an older ver
at present v 5.38.
sKurt
--
>> Why are you using call with xset32? Does it work without using call?
>> ** Posted from http://www.teranews.com **
>
>
>If using Windows XP I try XSET, it gives me the error message that I am
>using Win XP and I need to use CALL XSET32 to be able to use the program
>
>XSET.EXE & XSET32.CMD v 5.52
xset32 is a batch file (.cmd) which explains why it is being CALLed.
> >
> > If using Windows XP I try XSET, it gives me the error message that
> > I am using Win XP and I need to use CALL XSET32 to be able to use
> > the program
> >
> > XSET.EXE & XSET32.CMD v 5.52
>
> xset32 is a batch file (.cmd) which explains why it is being CALLed.
>
> ** Posted from http://www.teranews.com **
Yes, it is a .CMD batch file which is why it is being CALLed,
presumably there are some commands that must be initialized before
running XSET.EXE
But the 5.38 version seems to be doing the job for now.
Thanks
sKurt
--
Unfortunately, we can not help solve item 3 without specific details.
I use PV.EXE as well but your implementation with grep is a bit quirky.
Counting lines of output does not compute to me. If you want check if a
program is running, pipe it's output to find and check errorlevel.
> sKurt wrote:
> > 3. I believe last year you prompted me for the reloading of
> > command.com and the switch to make the environment bigger on the
> > fly, however, for some reason it would make the output corrupt, so
> > I removed it. The users never really see this code run as it
> > happens between 4 and 6 AM but I do run it from time to time
> > manually when they call in for help. I have it pop up a message to
> > have them change their environment, but it is mostly for me to see
> > if it needs to be changed.
> >
>
> Unfortunately, we can not help solve item 3 without specific details.
>
> I use PV.EXE as well but your implementation with grep is a bit
> quirky. Counting lines of output does not compute to me. If you want
> check if a program is running, pipe it's output to find and check
> errorlevel.
Yup, that's me quirky. But if I run PV PUSHPOS.EXE while PUSHPOS.EXE
is running, then there will be two instances for PV to see, so I output
them to a file and count the number of PUSHPOS.EXEs running, if there
is two, then EXIT the one I am trying to run again. Seems logical, if
not quirky ;)
As for 3, Here is a snippit I got as a suggestion, but removed it a
couple of days later as it seemed to mess things up more than help.
I suppose I should revisit it to eliminate the whole environment check
::+==========================================+
::| Adjust environment to 4096 while running |
::| to ensure enough environment to run this |
::+==========================================+
IF %1.==. command /e:4096 /c %0
It seemed to give strange results, however, I was just starting the
whole mess back then and probably was caused more my me than anything
else. Maybe now that things are pretty smooth, I should try again.
Thanks
sKurt
--
I have never seen PV add another instance of a program to the list before.
Do actually have two instances running when the PV command is issued?
>
>
> As for 3, Here is a snippit I got as a suggestion, but removed it a
> couple of days later as it seemed to mess things up more than help.
>
> I suppose I should revisit it to eliminate the whole environment check
>
> ::+==========================================+
> ::| Adjust environment to 4096 while running |
> ::| to ensure enough environment to run this |
> ::+==========================================+
>
> IF %1.==. command /e:4096 /c %0
>
>
>
> It seemed to give strange results, however, I was just starting the
> whole mess back then and probably was caused more my me than anything
> else. Maybe now that things are pretty smooth, I should try again.
I expect it would restart the batch in a new shell until you run out of
memory. This is because the IF test checks to see that %1 is empty and
restart the batch in a larger environment if it is. The problem with the
line is that you did not include a parameter to prevent infinite
recurrences. Also, since you forced a restart, you also need to abort the
remainder of the original batch when the child process ends.
IF NOT %1.==restart. command /e:4096 /c %0 restart
IF NOT %1.==restart. goto :end
You may still run into problems if you don't grasp the concept before
applying it. I suggest practicing with a smaller and simpler test batch.
> >
> > Yup, that's me quirky. But if I run PV PUSHPOS.EXE while
> > PUSHPOS.EXE is running, then there will be two instances for PV to
> > see, so I output them to a file and count the number of
> > PUSHPOS.EXEs running, if there is two, then EXIT the one I am
> > trying to run again. Seems logical, if not quirky ;)
>
> I have never seen PV add another instance of a program to the list
> before. Do you actually have two instances running when the PV >>>>
1. It's not PV that is running two instances, sometimes the PUSHPOS.EXE
program will hang up and just sit there, and if the next day if the
user justs minimizes the window the next copy of PUSHPOS.EXE would also
hang.
So I use PV to see if PUSHPOS.EXE is running, if it is already running,
then I EXIT the batch right away. Unfortunatly, if I try to kill the
current running PUSHPOS.EXE file (compiled .BAT) it totally locks up
the user's PC. When I had the .BAT totally using SED15 it would lock
up at random times. Now that I have switched totally to GAWK, it
hardly locks up, but it still might at the FTP window at times.
2. I'll give the new way a try. What is going to happen to my /DEBUG
/LOCAL /HELP switches? Do I now run;
PUSHPOS restart debug?
PUSHPOS restart local?
something is going to happen to the %1 variable that is going to kill
the current one right?
I'll try the first few attempts on a smaller test .BATch
Thanks again
sKurt
--
Sorry, I can not help you with this problem. I have no idea of what
PUSHPOS.EXE does or what the original batch code did prior to compiling it.
> 2. I'll give the new way a try. What is going to happen to my /DEBUG
> /LOCAL /HELP switches? Do I now run;
>
> PUSHPOS restart debug?
> PUSHPOS restart local?
>
> something is going to happen to the %1 variable that is going to kill
> the current one right?
>
> I'll try the first few attempts on a smaller test .BATch
Yes, do some testing. If you are stuck, you will need to post the code you
are using, give full details about what the batch is intended to do (the
purpose for the batch), what the original code for PUSHPOS.EXE was and
explain where the problems are.
1. PUSHPOS started out as a way for a site to PUSH the information we
normally POLL for. So if we couldn't get to a site for polling info,
then we could have the site PUSH the info needed, then it turned into
an information gathering machine ;) I'll try to post the code on my
psudo blog where you can view it in it's entirety and you can see where
it started and where it is now.
At first I used absyssmedia's Quick File Batch Compiler and it worked
fine for a while over a year, then I got hit with a false trojan error
that other people have had to work around, so I switched to ExeScript
compiler instead and so far so good. Can't say one is better than the
other, I was just looking to compile the .BATch for ease of
maintainability and so no 'power users' would be tempted to change
someting.
2. Sometime this week/end I'll put something together to try the
environment command trick
Thanks for the help
sKurt
--