Search found 31 matches

by Cornbeetle
01 Nov 2017 12:08
Forum: DOS Batch Forum
Topic: Help creating and implementing "switches" or "options" in custom batch script
Replies: 6
Views: 6079

Re: Help creating and implementing "switches" or "options" in custom batch script

Not sure if this is what you are looking for. foolproof counting of arguments Not so much validation, but simply an efficient reliable way to check with switches were used and then perform the appropriate action based on the user's input. Example: a custom script to search for file on a computer, w...
by Cornbeetle
01 Nov 2017 10:13
Forum: DOS Batch Forum
Topic: Help creating and implementing "switches" or "options" in custom batch script
Replies: 6
Views: 6079

Help creating and implementing "switches" or "options" in custom batch script

Is there any documentation/discussion, either in DosTips or elsewhere, on how to implement your own switches/options in a batch script? Such as, the best way to validate a switch inputted by the user, how to test which switch is used, etc...

Thanks :!:
by Cornbeetle
03 Feb 2017 16:40
Forum: DOS Batch Forum
Topic: Trouble with GetInput.exe and hovering.
Replies: 2
Views: 3686

Re: Trouble with GetInput.exe and hovering.

@Aacini

Thank you, I'm studying more of the documentation to get a better understanding.
by Cornbeetle
03 Feb 2017 12:36
Forum: DOS Batch Forum
Topic: Trouble with GetInput.exe and hovering.
Replies: 2
Views: 3686

Trouble with GetInput.exe and hovering.

Why are the two options "print" and "Scan" not affected correctly? I've set the coordinate range to cover each word for the hovering according to the errorlevel it gives when I click on "print" and "scan"... color 07 & cls echo Choose an option: echo Print...
by Cornbeetle
02 Feb 2017 15:17
Forum: DOS Batch Forum
Topic: So much hate for the GOTO command, why?
Replies: 9
Views: 9800

Re: So much hate for the GOTO command, why?

What are your thoughts, is it best to not use GOTO commands? There are only three reasons for a use of GOTO. 1) Generate loops (like "do-while" loops of other languages) 2) Quit the execution of a batch code or subroutine using GOTO :EOF 3) Quickly escape (break out of a FOR loop or jump ...
by Cornbeetle
02 Feb 2017 12:28
Forum: DOS Batch Forum
Topic: So much hate for the GOTO command, why?
Replies: 9
Views: 9800

Re: So much hate for the GOTO command, why?

@Squashman Agreed, that's why sometimes it's necessary and other times it can be ignored.
by Cornbeetle
02 Feb 2017 09:42
Forum: DOS Batch Forum
Topic: So much hate for the GOTO command, why?
Replies: 9
Views: 9800

So much hate for the GOTO command, why?

I try not to use GOTO commands as much as possible, and stick to flows like IFs and Elses, and loops. But sometimes GOTO is just necessary. What are your thoughts, is it best to not use GOTO commands? Here is the hate from StackOverflow http://stackoverflow.com/questions/18863309/the-equivalent-of-a...
by Cornbeetle
13 Jan 2017 13:48
Forum: DOS Batch Forum
Topic: Goto %loop%
Replies: 7
Views: 7767

Re: Goto %loop%

Not sure why you would need to do this.

Code: Select all

set label=:top

:top
set /a num+=1
echo %num%
goto %label%
by Cornbeetle
15 Dec 2016 15:56
Forum: DOS Batch Forum
Topic: Moving colored text (marquee sign), tips?
Replies: 4
Views: 4542

Re: Moving colored text (marquee sign), tips?

Duh..I didn't think about making the variable a 'space'...thanks! You could have at least shown that you'd made an attempt at something using the clue I gave you, which isn't incidentally the only way to do it. SetLocal EnableDelayedExpansion Set "_= " For /L %%A In (2,1,15) Do (Set "...
by Cornbeetle
15 Dec 2016 12:48
Forum: DOS Batch Forum
Topic: Moving colored text (marquee sign), tips?
Replies: 4
Views: 4542

Re: Moving colored text (marquee sign), tips?

Compo wrote:Clue:

Code: Select all

FOR /L %%A IN (2,1,15) DO …


But how would I change the spacing distance in between the quotes for each loop?

Code: Select all

call :applyColor 01 "            "
by Cornbeetle
15 Dec 2016 09:54
Forum: DOS Batch Forum
Topic: Moving colored text (marquee sign), tips?
Replies: 4
Views: 4542

Moving colored text (marquee sign), tips?

Here's the code I have for a moving marquee-style banner, using the showColor routine found on Stackoverflow (credit: Jeb) Does anyone have an idea how I can reduce this code into some type of loop, rather than block after block of the same code... @echo off color 07 setlocal EnableDelayedExpansion ...
by Cornbeetle
09 Dec 2016 09:59
Forum: DOS Batch Forum
Topic: Need help with my code string! Please!
Replies: 1
Views: 2607

Re: Need help with my code string! Please!

Take out the "set input=1" line in this block of code: :Username Set input=1 set/p input= ID if "%input%"=="" ( goto N2 Your pre-setting the input variable, so whenever someone hits enter, the input variable will remain as "1". It should look like this: :Usern...
by Cornbeetle
28 Oct 2016 13:30
Forum: DOS Batch Forum
Topic: Insert a space between every character in a given string?
Replies: 3
Views: 5004

Re: Insert a space between every character in a given string?

Thank you LotPings and aGerman, all of these are helpful and do exactly what I need.
by Cornbeetle
28 Oct 2016 11:19
Forum: DOS Batch Forum
Topic: Insert a space between every character in a given string?
Replies: 3
Views: 5004

Insert a space between every character in a given string?

I have a string of numbers set to variable "num". How can I insert a space in between each number to get the desired result below? set num=2212221 ?????? ?????? echo %numWithSpaces% 2 2 1 2 2 2 1 I could chop it up like this %num:~0,1% %num:~1,1% %num:~2,1% ... But if I dont know the strin...