Search found 194 matches

by T3RRY
26 Nov 2021 08:35
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

You should also check against code injection inputs like 'test=123" & echo(' with a big enough length like 10. I only found one reliable way to check whether the input string is empty. I'm not sure if i should post it here as it may spoil the fun out of it for others to discover that for themselves...
by T3RRY
25 Nov 2021 10:50
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

Classic off-by-one errors. Also, I totally missed that the first two lines in your sample input were where you were getting user input. Updated: https://github.com/sintrode/stringwalker I've edited the example and added an second example to avoid any further confusion There remains one final error ...
by T3RRY
25 Nov 2021 10:42
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

@Lowsun Your approach is succesful,Unfortunately however, error output is occuring for strings containing Doublequotes: C:\Users\tcdou>lowsun2 Enter string : !@#$%^&* :"": = end Enter number : 20 1:"!" 2:"@" 3:"#" 4:"$" 5:"%" 6:"^" 7:"&" 8:"*" 9:" " 10:":" The system cannot find the batch label spec...
by T3RRY
24 Nov 2021 21:24
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

Classic off-by-one errors. Also, I totally missed that the first two lines in your sample input were where you were getting user input. Updated: https://github.com/sintrode/stringwalker I've edited the example and added an second example to avoid any further confusion There remains one final error ...
by T3RRY
24 Nov 2021 21:14
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

I think, you need to provide some more detail on the input Edit: You also might want to limit to win10 cmd.exe only, because some solutions might not work on XP. Thanks for your suggestions. I have edited the opening post to provide some more clarity about forms of input, the environment that will ...
by T3RRY
24 Nov 2021 08:47
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

How can there be no character at an index if the string continues past that index? If you pass the sample input you provided to my script, it matches your output exactly. > Take 2 Inputs of the following types: - A string containing any combination of printable ASCII characters that may be of any l...
by T3RRY
24 Nov 2021 08:35
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

Glad to see a number of people taking on the challenge - Seeing as the cats out the bag and multiple solutions have already been posted, I wont hold back till the weeks up with mine: The original version: Rem original golfed version: Rem https://pastebin.com/gp86e5mK Rem Pastebin Pass: split @Set x=...
by T3RRY
24 Nov 2021 08:29
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

I just thought of an interesting solution, but it doesn't fit the requirements (no number literals) and I don't think it's possible without them, so I'll just post it here. @ECHO OFF SET /P "str=Enter string : " SET /P "max=Enter number : " SET "num=1" ( FINDSTR "^;" "%~f0" ECHO :%max% ECHO PAUSE E...
by T3RRY
24 Nov 2021 08:23
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

Not sure if I'll find the time to work on that any further. Proof of concept: @echo off &setlocal set "s=This (!@#$%^&*() String" set "n=15" call set "s=%%s:~,%n%%%" cmd /u /c ^"<nul set /p "=%s%"^"|find /v ""|findstr /n "^" pause Steffen Beautiful solution, the only shortcoming is that it doesn't ...
by T3RRY
24 Nov 2021 08:21
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Re: Coding challenge for any interested parties

The hardest part was doing this without an if statement. https://github.com/sintrode/stringwalker Vey close, A couple of easily resolved Issues exist though: - Display of the expanded string on line 26 (Which is not required) Results in a syntax error with redirection characters or pipes. - Script ...
by T3RRY
23 Nov 2021 09:35
Forum: DOS Batch Forum
Topic: Coding challenge for any interested parties
Replies: 20
Views: 556

Coding challenge for any interested parties

*Following PenPen's suggestions, some edits have been made to provide clarity * Background: I enjoy batch scripting and a bit of code golfing in my spare time, and generally enjoy activities that require a degree of problem solving. I find batch to be interesting simply because there's a multitude ...
by T3RRY
14 Nov 2021 04:44
Forum: DOS Batch Forum
Topic: Limiting echo & Output word "on"
Replies: 6
Views: 417

Re: Limiting echo

1. How to limit what echo is to process, without splitting the line? example Prompt:>if 2 GTR 1 echo bigger else echo lesser result: bigger else echo lesser 2. How to echo "ON" instead of turning echo on? Your problem is not with echo, it's with your failure to use correct If else syntax: if ( comm...
by T3RRY
29 Oct 2021 23:01
Forum: DOS Batch Forum
Topic: Live coundown timer
Replies: 10
Views: 1076

Re: Live coundown timer

drgt wrote:
29 Oct 2021 13:11
xp sp2!
Information like this is useful to provide when asking a question.

An alternative to timeout for you to try:

Code: Select all

start "" /w /b /min mshta "javascript:setTimeout(function(){close();},1000);"
by T3RRY
29 Oct 2021 12:37
Forum: DOS Batch Forum
Topic: Live coundown timer
Replies: 10
Views: 1076

Re: Live coundown timer

yes, this is easily possible, however, more information regarding the use case would be helpful. IE: does it matter if the timer is script blocking, or do you want to just show a timer while the script is executing something else? An example of a no frills timer that blocks script execution: @ECHO o...
by T3RRY
24 Sep 2021 04:10
Forum: DOS Batch Forum
Topic: Best way to pull out specifc lines from text file? JREPL?
Replies: 6
Views: 2212

Re: Best way to pull out specifc lines from text file? JREPL?

I wonder "Where the trivial PS code is?" :shock: IMHO in this type of answers the poster should warn: "This PS solution is more difficult and convoluted than a Batch file, but here it is anyway"... :? Antonio Sorry Antonio, but I fail to see what's not trivial about using regex to match desired pat...