Search found 1761 matches

by penpen
11 Feb 2020 07:42
Forum: DOS Batch Forum
Topic: Multi-line commands with leading spaces
Replies: 7
Views: 549

Re: Multi-line commands with leading spaces

If you think about it, one should expect to fail executing the echo command in:

Code: Select all

for %%x in (*.txt) do ^
    echo %%x
The reson is simple:
You don't execute the echo-command but a single space!

Code: Select all

@echo off
>" .bat" echo(@echo(executing "%%~nx0"
for %%x in (1) do ^
    echo %%x
penpen
by penpen
09 Feb 2020 18:52
Forum: DOS Batch Forum
Topic: Multi-line commands with leading spaces
Replies: 7
Views: 549

Re: Multi-line commands with leading spaces

If i remember right and your term "always" means "since XP", then yes, it was always like that.
The only way i remember using extra spaces, is to use round brackets (which makes that escape character pretty useless):

Code: Select all

for %%x in (*.txt) do (^
    echo %%x
)
penpen
by penpen
09 Feb 2020 18:36
Forum: DOS Batch Forum
Topic: Surprising difference between command line and batch
Replies: 7
Views: 583

Re: Surprising difference between command line and batch

It seems like escaping a character that doesn't need escaping doesn't count as beeing escaped: >test "^a^ b.bat" var=^a^ b.bat Command Line NO CALL: Der Befehl "a" ist entweder falsch geschrieben oder konnte nicht gefunden werden. Batch File CALL: executing "a b.bat" Batch File NO CALL: executing "a...
by penpen
09 Feb 2020 14:12
Forum: DOS Batch Forum
Topic: How to search in pdf and use found string for renaming
Replies: 3
Views: 472

Re: How to search in pdf and use found string for renaming

I also had the idea to start and control the conversion program via batch. However, I don't know how to do that using the batch command. I think that would also be very complex or not feasible. It might be complex and not feasible, some programs not even support command line arguments at all; but w...
by penpen
08 Feb 2020 15:30
Forum: DOS Batch Forum
Topic: How to search in pdf and use found string for renaming
Replies: 3
Views: 472

Re: How to search in pdf and use found string for renaming

If the content of your PDFs are not encrypted and if the text is not rendered based on binary data representation, then you should be able to use batch for that task (you could open your PDFs in notepad.exe to see if the search string could be found there), although other script languages like vbs o...
by penpen
08 Feb 2020 15:18
Forum: DOS Batch Forum
Topic: [SOLVED] Script to older version of files when new ones are copied in?
Replies: 7
Views: 506

Re: Script to older version of files when new ones are copied in?

You could move all existing versions of that files to the backup folder (matching "HouseMap[*].jpg" ) before you copy your new version of that file to that folder. Assuming the following "next.bat" batch file is located in the parent directory of both of your named directories "Current" and "Backup"...
by penpen
07 Feb 2020 13:31
Forum: DOS Batch Forum
Topic: Copy name
Replies: 27
Views: 1024

Re: Copy name

You could write a little C++ or C# program, see examples here: - C++ https://stackoverflow.com/a/3011284 and - C# https://stackoverflow.com/a/3578581 . Depending on the needed used version the C# sample might been compilable using batch, see: https://www.dostips.com/forum/viewtopic.php?t=5260 . penpen
by penpen
06 Feb 2020 05:52
Forum: DOS Batch Forum
Topic: Copy name
Replies: 27
Views: 1024

Re: Copy name

I used something similar for a link in the win10 "sendto" menue - but i don't know if that also works for buttons in openshell, so the following might or might not help you: %comspec% /V:ON /E:ON /c @for %n in (1 2) do @if %n == 2 (if defined params for %b in (!params!) do @call <nul set/p= "%~nb" |...
by penpen
03 Feb 2020 13:53
Forum: DOS Batch Forum
Topic: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect
Replies: 28
Views: 1236

Re: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect

But I hope this doesn't depends with the redirection parser. Perhaps it's only a strange side effect of the "<" wildcard mechanism (Dave has written about that) Yes, it's the wildcard mechanism, "<com" is just the first .com file in path (like "finds<<"). Maybe i used "related to redirection" a bit...
by penpen
03 Feb 2020 11:35
Forum: DOS Batch Forum
Topic: Batch Output Redirection
Replies: 1
Views: 409

Re: Batch Output Redirection

Typically access to files in the root directory of your system drive (typically "C:") is restricted, so use files in a subfolder.

penpen
by penpen
03 Feb 2020 11:10
Forum: DOS Batch Forum
Topic: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect
Replies: 28
Views: 1236

Re: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect

You could also drop tokens if you escape a leading redirection: ^<skipped nul echo OK. And just for the record, two results from yesterday (related to redirection; win version 10.0.18362.592): @set "prompt=#" @cls "<com" nul echo Test 1: Expected a different error, see tests 2 and 3. :: funny reason...
by penpen
02 Feb 2020 18:14
Forum: DOS Batch Forum
Topic: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect
Replies: 28
Views: 1236

Re: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect

Btw. I think I remember a post some time ago from one of the experts about the disappearing tokens. He had used a debugger and said something about buffer pointer resets after multiline carets. But I cant remember the details nor can I find the post :( I thought i found something new when my test.b...
by penpen
31 Jan 2020 18:45
Forum: DOS Batch Forum
Topic: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect
Replies: 28
Views: 1236

Re: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect

Now you (penpen) have discovered another complication with this redirection line continuation process. To be honest, that is jeb's example in disguise (replaced all variables): https://www.dostips.com/forum/viewtopic.php?p=32687#p32687 I further minimized that example (and played around) - it's def...
by penpen
31 Jan 2020 15:56
Forum: DOS Batch Forum
Topic: VBS and BAT parameters
Replies: 1
Views: 416

Re: VBS and BAT parameters

The following might help you (untested; are you sure your vbs is correct?). "test.bat": @echo off setlocal enableExtensions disableDelayedExpansion rem Get last weeks Monday-Saturday dates for /F "tokens=* delims=" %%n in ('cscript.exe //nologo GetLastWeek.VBS') do set "%%~n" set last goto :eof "Get...
by penpen
31 Jan 2020 04:29
Forum: DOS Batch Forum
Topic: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect
Replies: 28
Views: 1236

Re: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect

I'm unsure if i miss something (currently too little time, sry), but i don't see why the "nul" in the next example is removed (the leading "<" is kept): @echo on @set "prompt=#" echo set macro=(^ >con ^ <nul ^ cmdToken and some params^ ) @set "prompt=" @goto :eof Result: #echo set macro=( and some p...