Search found 4 matches

by Alogon
25 Sep 2021 23:01
Forum: DOS Batch Forum
Topic: Strange behavior of SET /P
Replies: 2
Views: 4309

Strange behavior of SET /P

if 1==1 ( set A= set /P A= [in parens] What shall A be? echo A=%A% ) set A= set /P A=[not in parens] What shall A be? echo A=%A% Only the second set /P works properly. When the statement is in a parenthesized block, it does not set the variable. While experimenting just now, I noticed two other ano...
by Alogon
03 May 2020 10:19
Forum: DOS Batch Forum
Topic: file counter
Replies: 0
Views: 15262

file counter

This is offered more as something you might find useful than to ask a question. However, if you see possible improvements, I'm all ears. I use several batch files to relieve the burden of handling gothic-novel file and directory names in command prompt. Today I encountered a need to ensure that a wi...
by Alogon
03 May 2020 10:02
Forum: DOS Batch Forum
Topic: Shift and %*
Replies: 5
Views: 7094

Re: Shift and %*

Thanks, Dave. This is what I've done, and it works fine most of the time. Occasionally, however, there are multiple consecutive spaces in the argument which I'd want to preserve.
by Alogon
06 Apr 2020 19:45
Forum: DOS Batch Forum
Topic: Shift and %*
Replies: 5
Views: 7094

Shift and %*

@echo off echo %1 shift echo %* --------- If the above batch file is run with arguments 1 2 3 4, the output will be: 1 1 2 3 4 Shift does not affect the value of %*, which retains all the original arguments. What I would like is for the first argument to be a normal argument (perhaps a 'switch' like...