Search found 3804 matches

by aGerman
29 Sep 2020 11:20
Forum: DOS Batch Forum
Topic: Batch to display Happy Birthday
Replies: 3
Views: 87

Re: Batch to display Happy Birthday

I didnt find an Easter algorithm here, so I decided to write one. Just in case you're interested ...
viewtopic.php?f=3&t=9792#p62989

Steffen
by aGerman
29 Sep 2020 11:18
Forum: DOS Batch Forum
Topic: [How-To] Calculate the date of Easter Sunday
Replies: 0
Views: 49

[How-To] Calculate the date of Easter Sunday

Because of a recent request I searched the forum for an Easter calculation but didn't find one. Here you go ... @echo off &setlocal EnableDelayedExpansion for %%i in (1590 1666 1685 1924 1943 1962 2019 2038 2057 2076 2095 2133 2152 2171 2190) do ( call :easter %%i echo !errorlevel! ) echo ~~~~~~~~~~...
by aGerman
29 Sep 2020 10:44
Forum: DOS Batch Forum
Topic: Get the total size of all subdirectories with a specific name
Replies: 4
Views: 94

Re: Get the total size of all subdirectories with a specific name

Basically not a big deal @echo off &setlocal set "root=C:\somewhwere" set "folder=resfiles" set /a "count=0,size=0" for /f "delims=" %%i in ('dir /ad /b /s "%root%\*%folder%"^|findstr /eic:"\\%folder%"') do ( set /a "count+=1" for /f "tokens=1,2 delims=: " %%a in ('robocopy "%%i" "%%i" /L /S /NJH /B...
by aGerman
28 Sep 2020 10:59
Forum: DOS Batch Forum
Topic: Get the total size of all subdirectories with a specific name
Replies: 4
Views: 94

Re: Get the total size of all subdirectories with a specific name

There are some threads about the size of a directory here at DosTips, like that one: https://www.dostips.com/forum/viewtopic.php?f=3&t=9615&p=62024 Although I still have my doubts that Batch is the right language for a task like this. Even if you are able to get the total size, keep in mind that mat...
by aGerman
28 Sep 2020 10:47
Forum: DOS Batch Forum
Topic: Batch to display Happy Birthday
Replies: 3
Views: 87

Re: Batch to display Happy Birthday

No problem for holidays or anniversaries at a fixed date. @echo off &setlocal for /f %%i in ('WMIC OS Get LocalDateTime /value') do for /f %%j in ("%%i") do set "%%j" if "%LocalDateTime:~4,4%"=="0928" echo Happy Today! if "%LocalDateTime:~4,4%"=="1225" echo Merry Christmas! pause But for days like E...
by aGerman
26 Sep 2020 08:58
Forum: DOS Batch Forum
Topic: batch file inserting new lines before a string in text file
Replies: 7
Views: 1143

Re: batch file inserting new lines before a string in text file

Always depends on how the content of your file actually looks like. @echo off &setlocal set "inputfile=file1.txt set "outputfile=file2.txt" set "find=;word " setlocal EnableDelayedExpansion <"!inputfile!" >"!outputfile!" ( for /f %%i in ('type "!inputfile!"^|find /c /v ""') do for /l %%j in (1 1 %%i...
by aGerman
22 Sep 2020 12:13
Forum: DOS Batch Forum
Topic: Command line to write registry keys bypassing any prompt
Replies: 5
Views: 154

Re: Command line to write registry keys bypassing any prompt

After initial testing, it didn't work. Syntax error on Char 99. After reviewing the code i tested again and i spot the error you left on purpose :) :?: Tested now and it works out of the box in a cmd shell as well as in a batch file. FWIW No idea what this should be even good for. A simple REG ADD ...
by aGerman
21 Sep 2020 13:36
Forum: DOS Batch Forum
Topic: Command line to write registry keys bypassing any prompt
Replies: 5
Views: 154

Re: Command line to write registry keys bypassing any prompt

The double backslash works in the original code The original code is JScript. Your recent code is VBScript. They are not the same thing. Can you provide with a sample ... What was wrong with my explanation? mshta vbscript:(CreateObject("WScript.Shell").RegWrite("HKCU\Software\Microsoft\Windows\Curr...
by aGerman
21 Sep 2020 11:07
Forum: DOS Batch Forum
Topic: Command line to write registry keys bypassing any prompt
Replies: 5
Views: 154

Re: Command line to write registry keys bypassing any prompt

At least you have to escape the comma with a caret because it's a separator for arguments in a command line. And I'm pretty sure the double backslashes are wrong in the VBS syntax. I haven't tested though.

Steffen
by aGerman
16 Sep 2020 06:37
Forum: DOS Batch Forum
Topic: Forfiles and escape char
Replies: 2
Views: 153

Re: Forfiles and escape char

If I count the quotes then it seems that the closing parenthesis right before the point is neither escaped nor quoted. I suspect it is treated as to be closing the FOR clause. Try to escape it with a caret. Probably the equal sign, too. Something like that for the regex pattern ... "(?<=\"access_tok...
by aGerman
07 Sep 2020 12:26
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 469
Views: 374934

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

How exactly did you use it? Just because I can't repreduce your result.

Code: Select all

C:\Users\neffe\Desktop>echo PROXY proxy-aaa.bbbbbb.com:789|jrepl ".*[^0-9A-Za-z\.]([0-9A-Za-z\.]+):([0-9]+).*" "$1:$2"
aaa.bbbbbb.com:789
Steffen
by aGerman
07 Sep 2020 12:17
Forum: DOS Batch Forum
Topic: LABEL Being Processed without GOTO or CALL
Replies: 11
Views: 2062

Re: LABEL Being Processed without GOTO or CALL

The equal sign is easier to type as well. Highly dependent on the keyboard layout. It's [Shift]+[0] on my QWERTZ keyboard :lol: But I also prefer characters that don't generate errors. Usually I just write a line of colons. I've also seen that people indent the code of subruotines. With keeping the...
by aGerman
06 Sep 2020 07:50
Forum: DOS Batch Forum
Topic: How to create files.ext from .txt??
Replies: 3
Views: 316

Re: How to create files.ext from .txt??

Probably something like that (provided the name of the text file is "test.txt"):

Code: Select all

for /f "usebackq tokens=1* delims=, " %%i in ("test.txt") do >"%%j" type nul
Of course the files are empty. How should we know what content is expected ...

Steffen
by aGerman
05 Sep 2020 08:46
Forum: DOS Batch Forum
Topic: Making a program process multipe files and........can I ask for assitance
Replies: 8
Views: 421

Re: Making a program process multipe files and........can I ask for assitance

Well, I don't know what software does generate these files. If you know it then you could try to find specifications of the files. The drones or their brand might have specific forums where you could find those information or where you could ask for it.

Steffen
by aGerman
05 Sep 2020 08:33
Forum: DOS Batch Forum
Topic: Making a program process multipe files and........can I ask for assitance
Replies: 8
Views: 421

Re: Making a program process multipe files and........can I ask for assitance

Without knowing the content of your files and the related format specification I'm afraid we can't help out at all. And in case the "not human readable" means that the data is saved in a binary format a Batch script will most likely not be able to process the content. Only plain text.

Steffen