Search found 91 matches
- 10 Aug 2013 23:29
- Forum: DOS Batch Forum
- Topic: Question about %$Strlen% maco
- Replies: 4
- Views: 4565
Re: Question about %$Strlen% maco
Whereas these macros work from the command line: @echo off :: MacroStringLib.bat :: :: This script installs macros that can be used for string operations :: :: The script defines the following variables: :: :: #LF - A variable containing a line feed character :: :: #CR - A variable containing a carr...
- 10 Aug 2013 23:06
- Forum: DOS Batch Forum
- Topic: Question about %$Strlen% maco
- Replies: 4
- Views: 4565
Question about %$Strlen% maco
Ok, I put this into 'teststrlen.bat' and type at the command line: C:\>teststrlen This string is 22 long @echo off call :loadMacros set "myVar=%*" %$Strlen% myVar result echo %myvar% is %result% characters long exit /b :loadMacros set LF=^ ::Above 2 blank lines are required - do not remove...
- 09 Aug 2013 19:32
- Forum: DOS Batch Forum
- Topic: Setting variable limits
- Replies: 7
- Views: 5425
Re: Setting variable limits
Sometimes if the else will bomb at the if statement. If a variable has spaces or potentially does you have to quote both sides: C:\>set "variable=My space" C:\>set "whatever=My space" C:\>If %variable%==%whatever% (echo equal) else (echo not equal) C:\>space==My was unexpected at...
- 09 Aug 2013 00:33
- Forum: DOS Batch Forum
- Topic: return over an endlocal barrier with a macro
- Replies: 6
- Views: 7985
Re: return over an endlocal barrier with a macro
jeb, if anyone can solve it, you can. I think solving the multiple variable option is more important than the macro only attempt, heroic as it may be. I am just amazed by what can be done with this archaic programming language with the very limited tools available. But the beauty is portability amon...
- 08 Aug 2013 23:39
- Forum: DOS Batch Forum
- Topic: Store whole out put into a string
- Replies: 7
- Views: 5834
Re: Store whole out put into a string
How about pinging everyone on Earth?? :Ping the Earth.bat @echo off echo(Pinging the Earth starting at: %date%.%time%>"Ping the Earth.log" for /l %%a in (0 1 255) do ( for /l %%b in (0 1 255) do ( for /l %%c in (0 1 255) do ( for /l %%d in (0 1 255) do ( call :pingit "%%a.%%b.%%c.%%d&...
- 08 Aug 2013 22:39
- Forum: DOS Batch Forum
- Topic: Store whole out put into a string
- Replies: 7
- Views: 5834
Re: Store whole out put into a string
Here is a method to avoid writing to a file: @echo off setLocal enableDelayedExpansion if "%~1" equ "" goto :pingFailure set/a line=0 for /f "delims=" %%a in ('ping %~1') do ( set/a line+=1 echo(%%a|find "Received = 0" >nul if !errorlevel! equ 0 goto :pingFail...
- 07 Aug 2013 21:39
- Forum: DOS Batch Forum
- Topic: How to get a batch file to set paths depending on OS?
- Replies: 5
- Views: 5095
Re: How to get a batch file to set paths depending on OS?
This is what I do but you must be beyond a setlocal to avoid screwing with the path: setlocal if defined ProgramFiles(x86) set "ProgramFiles=%ProgramFiles(x86)%" start "" "%ProgramFiles%\The Program path\The Program.exe" endlocal&exit/b if you are in a 32 bit system...
- 07 Aug 2013 20:09
- Forum: DOS Batch Forum
- Topic: return over an endlocal barrier with a macro
- Replies: 6
- Views: 7985
Re: return over an endlocal barrier with a macro
Wow jeb! Awesome. It works great. I presume the routine must reside in a function/macro library since the helper function is necessary and thus routines that call the macro must be able to access the helper function or else the code must be included in any routine that uses the macro. How do you lik...
- 28 Jul 2013 17:01
- Forum: DOS Batch Forum
- Topic: Batch macro vs function call test
- Replies: 18
- Views: 17406
Batch macro vs function call test
I modified Don Cross' Pi.bat with function calls and replaced the 6 easy ones with macros. The remaining functions contain loops or are not called till the end of the program. It uses the formula: π = 48*arctan(1/18) + 32*arctan(1/57) - 20*arctan(1/239) and calculates pi to 108 decimal places. Time ...
- 26 Jul 2013 18:07
- Forum: DOS Batch Forum
- Topic: SokoBox 1.1
- Replies: 5
- Views: 4728
Re: SokoBox 1.1
OK, I give. "UNCLE!"
need a hint for level 144, thx.
need a hint for level 144, thx.
- 25 Jul 2013 10:44
- Forum: DOS Batch Forum
- Topic: GetVar.bat and Eco.bat
- Replies: 2
- Views: 2976
Re: GetVar.bat and Eco.bat
Thanks again, jeb
- 24 Jul 2013 22:18
- Forum: DOS Batch Forum
- Topic: Problems with calling script from enabledExpanion environmnt
- Replies: 2
- Views: 2893
- 24 Jul 2013 21:57
- Forum: DOS Batch Forum
- Topic: GetVar.bat and Eco.bat
- Replies: 2
- Views: 2976
GetVar.bat and Eco.bat
I have 3 or 4 hairs left in my head after pulling them out in frustration as I tried to perfect these routines using batch only techniques to get these results. GetVar.bat gets user input no matter how deviously poison characters are entwined and stores them in a variable name passed to the routine ...
- 10 Jul 2013 00:13
- Forum: DOS Batch Forum
- Topic: how to display password in asterisk
- Replies: 15
- Views: 37434
Re: how to display password in asterisk
Here is an example of asking for a user name and password and encrypting the results into a file that can retrieve the password based on user name. The routine can accept all characters entered from the keyboard but the only editing available is a backspace... No home, end, insert, del, etc. It gets...
- 05 Jul 2013 21:35
- Forum: DOS Batch Forum
- Topic: Problems with calling script from enabledExpanion environmnt
- Replies: 2
- Views: 2893
Problems with calling script from enabledExpanion environmnt
A previous topic related to masking input chars with '*' when collecting a password and was addressed with an 'Xcopy' solution that was pretty clever: Set "key=" For /F "delims=" %%# In ( 'Xcopy /L /W "%~f0" "%~f0" 2^>Nul' ) Do If Not Defined Key Set "Key...