Search found 1761 matches

by penpen
30 Jan 2020 15:44
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 finally remembered, where i saw that: In the topic "Comments without increasing macro size" post #1 : To avoid this you can simply use the obvious :wink: dummy redirect trick. echo Word1<nul ^ %= REM this is a comment line%^ Word2 In post #10 jeb noticed that technique removes a token: First a sam...
by penpen
30 Jan 2020 11:24
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

My hypothesis for that behaviour was,that CR could be a not escapable character, which just ends the actual token (and starts a new one). Then i saw the "echo #5 example"... . echo #5: 3 is ... part of redirect 4>NUL -^ %$CR%3>&2 END The minus-char is ignored, but i think that has only todo with the...
by penpen
29 Jan 2020 18:33
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

What proof do we have that removing <CR> characters is performed in an own phase and not handled as a special character in Phase 2, where tokenization might cause that above difference?
I tried to search it, but my google-fu is not strong enough tonight... :( .

penpen
by penpen
26 Jan 2020 09:48
Forum: DOS Batch Forum
Topic: best way to encrypt passwords in cmd files?
Replies: 7
Views: 742

Re: best way to encrypt passwords in cmd files?

The "best way..." you are asking for most probably depends on what you want to achieve with your batch file. So, why do you want to store passwords in batch? Do you want to create a password-safe (~= collection of passwords enrypted), do you want to create some kind of registration, or a login-scrip...
by penpen
23 Jan 2020 04:45
Forum: DOS Batch Forum
Topic: right click command line help
Replies: 7
Views: 608

Re: right click command line help

If you are using a link for the sendto menue, this might help you (tested on Win10) to type into the field "target" of the link (properties; this only echoes the command lines): C:\Windows\System32\cmd.exe /V:ON /E:ON /k @for %n in (1 2) do @if %n == 2 (for %b in (!params!) do @call echo("C:\Program...
by penpen
22 Jan 2020 19:08
Forum: DOS Batch Forum
Topic: Start Task when date arrived
Replies: 3
Views: 446

Re: Start Task when date arrived

Depending on your implementation of determining "within the next 9 days", your solution might not give you the message that you wnated it to appear (for example if the actual date were the "31.01.2020" and the date you are comparing to were "01.02.2020"). You could use jTimestamp.bat or an own custo...
by penpen
21 Jan 2020 14:42
Forum: DOS Batch Forum
Topic: Explain batch script - need some help
Replies: 2
Views: 467

Re: Explain batch script - need some help

If i remember right, then ... You list your pc's routing table using: NETSH INTERFACE IPv4 SHOW ROUTE The pipe "^|" redirects the output to a find command to filter the (unique) entry of the default IPv4-Prefix "0.0.0.0/0" (== the range of IP addresses from 0.0.0.0 to 255.255.255.255 == all possible...
by penpen
18 Jan 2020 04:47
Forum: DOS Batch Forum
Topic: If/Else in 1 line--only do something from Else statement
Replies: 6
Views: 555

Re: If/Else in 1 line--only do something from Else statement

What is the best coding form in writing this If/Else statement on 1 line? That depends on how you define the term "best coding" (the fastest, the easiest to read, the most beautiful to read, ...) and what exactly you want to change (that part "(echo OK)" only, ..., all). For example you could use: ...
by penpen
14 Jan 2020 03:57
Forum: DOS Batch Forum
Topic: Blockout (3d Tetris) !
Replies: 13
Views: 3813

Re: Blockout (3d Tetris) !

Although that actually is offtopic (this is not the Blockout of California Dreams from 1989), i left it here to be understand as a
suggestion to misol101 on how to further develope his implementation of that game.

penpen
by penpen
14 Jan 2020 03:41
Forum: DOS Batch Forum
Topic: Redirect text to a file (runas command result)
Replies: 13
Views: 708

Re: Redirect text to a file (runas command result)

I actually can't test if redirecting is possible with runas at all, but if it were then i assume you need both streams (stdio and stderr); untested:

Code: Select all

echo.|((runas /user:administrator echo %date%" 2>&1) >"test.txt")
penpen
by penpen
11 Jan 2020 13:39
Forum: DOS Batch Forum
Topic: Edit and Save and XML with a Batch Script
Replies: 2
Views: 434

Re: Edit and Save and XML with a Batch Script

You could use a bat-jscript hybrid and xslt to change the xml data; example:
viewtopic.php?p=32941#p32941
(Then overwrite the old file with the new one.)

penpen
by penpen
09 Jan 2020 17:22
Forum: DOS Batch Forum
Topic: Change the system date
Replies: 2
Views: 442

Re: Change the system date

Dealing with dates is highly system dependent, so the following might (or mght not) help you (untested): @echo off setlocal enableExtensions enableDelayedExpansion for %%a in ( "jan=-01-" "feb=-02-" "mar=-03-" "apr=-04-" "mai=-05-" "jun=-06-" "jul=-07-" "aug=-08-" "sep=-09-" "oct=-10-" "nov=-11-" "d...
by penpen
24 Dec 2019 19:38
Forum: DOS Batch Forum
Topic: How do I....
Replies: 3
Views: 684

Re: How do I....

Another option were to use xslt to change the xml data; example:
viewtopic.php?p=32941#p32941

penpen
by penpen
24 Dec 2019 19:34
Forum: DOS Batch Forum
Topic: For /f loop findstr problem The batch script finds nothing !!!
Replies: 2
Views: 623

Re: For /f loop findstr problem The batch script finds nothing !!!

for /f "skip=1 tokens=* usebackq" %%a in (`^""C:\Program Files\7-Zip\7z.exe" h -scrcsha256 "Test.7z" ^| findstr "SHA256 for data"^"`) do echo %%a The batch script finds nothing !!!! I tested that batch code and it works?! Maybe you wanted to add a "/c:" (without doublequotes) like in the sniplet ab...