Search found 3431 matches

by aGerman
19 Apr 2019 09:31
Forum: DOS Batch Forum
Topic: gzip batch
Replies: 16
Views: 108

Re: gzip batch

Come on Squashman. His explanation is in English. The French text is the quoted output of the DIR command. I suspect you don't need a translation for the header and footer :wink:

Steffen
by aGerman
14 Apr 2019 15:39
Forum: DOS Batch Forum
Topic: how to preserve leading spaces in parameter during function call
Replies: 4
Views: 57

Re: how to preserve leading spaces in parameter during function call

Spaces are separators for command line arguments (not only on Windows btw). Say you have a string like that: a b c (note there are spaces behind c, too) If you pass that string in a command line then leading and trailing spaces are discarded, multiple spaces in between are treated as one and are use...
by aGerman
12 Apr 2019 11:13
Forum: DOS Batch Forum
Topic: Taskkill comand error
Replies: 2
Views: 64

Re: Taskkill comand error

/F is an additional option. You still have to use /IM to introduce the process name.
Why do people never read the help messages of a command? All you have to do is executing TASKKILL /?

Steffen
by aGerman
12 Apr 2019 05:47
Forum: DOS Batch Forum
Topic: pass value to string handle function failed
Replies: 8
Views: 80

Re: pass value to string handle function failed

First of all - why don't you just use the FOR /L variable. I don't understand what n is even good for.

Another possibility:

Code: Select all

for /l %%i in (1,1,7) do (
   for %%j in (!n!) do echo !input_line:~0,%%j!
   set /a "n+=1"
)
Steffen
by aGerman
11 Apr 2019 13:48
Forum: DOS Batch Forum
Topic: NEED HELP WITH CHESS TOURNMENT FILES
Replies: 3
Views: 76

Re: NEED HELP WITH CHESS TOURNMENT FILES

I hope my request is clear enought. No, sorry. I tried to find the values of the Elo program in the example you quoted but I didn't find them. Furthermore you told that you want to have everything in a csv file but you didn't tell us how it should look like. So you really should provide an csv exam...
by aGerman
11 Apr 2019 13:33
Forum: DOS Batch Forum
Topic: how do I rename *.3gp.mp4 to *.mp4?
Replies: 1
Views: 46

Re: how do I rename *.3gp.mp4 to *.mp4?

Use FOR loops and the format specifiers of FOR variables.

Code: Select all

for %%i in (*.3gp.mp4) do for %%j in ("%%~ni") do ECHO ren "%%~i" "%%~nj%%~xi"
Remove the ECHO if it outputs the right commands.

Steffen
by aGerman
11 Apr 2019 09:04
Forum: DOS Batch Forum
Topic: pass value to string handle function failed
Replies: 8
Views: 80

Re: pass value to string handle function failed

Code: Select all

echo !input_line:~0,%count_of_chars%!
Steffen
by aGerman
09 Apr 2019 10:30
Forum: DOS Batch Forum
Topic: set %RANDOM% for timeout command
Replies: 7
Views: 130

Re: set %RANDOM% for timeout command

Good enough for that purpose. The reason why I didn't propose the modulus calculation is that the results have a slight displacement towards lower values. Division by 32768 generates a better distribution.

Steffen
by aGerman
08 Apr 2019 12:19
Forum: DOS Batch Forum
Topic: set %RANDOM% for timeout command
Replies: 7
Views: 130

Re: set %RANDOM% for timeout command

timeout test
You forgot the percent signs.

Steffen
by aGerman
06 Apr 2019 13:54
Forum: DOS Batch Forum
Topic: string as statement
Replies: 4
Views: 89

Re: string as statement

It means that exclamation points have a special meaning if delayed expansion is enabled. Variable var gets already evaluated in your outer SET statement but is not yet defined. Thus, you have to escape them, too. Either set str1=set var1=hi cat^&echo ^^!var1^^! or quoted set "str1=set var1=hi cat&ec...
by aGerman
05 Apr 2019 07:02
Forum: DOS Batch Forum
Topic: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33
Replies: 9
Views: 108

Re: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33

aGerman wrote:
05 Apr 2019 06:50
Does the file consist of only one line? [...] What is the maximum length of a line?
by aGerman
05 Apr 2019 06:50
Forum: DOS Batch Forum
Topic: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33
Replies: 9
Views: 108

Re: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33

Does the file consist of only one line? Have lines always the same length? What is the maximum length of a line?
Batch has so many limitations. The code we are able to write is only as good as the information you give.

Steffen
by aGerman
05 Apr 2019 06:45
Forum: DOS Batch Forum
Topic: merge multiple text files into one text file
Replies: 5
Views: 57

Re: merge multiple text files into one text file

I don't understand your question. I just try to tell you that you should avoid to append the data already written to "Datafile.txt" once more. For that reason "Datafile.txt" has to be excluded from the files that the FOR loop found. Just have a look at the IF statement in my code.

Steffen
by aGerman
05 Apr 2019 06:37
Forum: DOS Batch Forum
Topic: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33
Replies: 9
Views: 108

Re: Convert 1111 2222 3333 in \x11\x11\x22\x22\x33\x33

@echo off &setlocal set "in_file=test.txt" set "out_file=test2.txt" setlocal EnableDelayedExpansion <"!in_file!" >"!out_file!" ( for /f %%i in ('type "!in_file!"^|find /c /v ""') do for /l %%j in (1 1 %%i) do ( set "line=" &set /p "line=" if defined line ( set "line=!line: =!" echo \x!line:~0,2!\x!...
by aGerman
05 Apr 2019 06:14
Forum: DOS Batch Forum
Topic: how to make an array by function and by local variable of the function
Replies: 5
Views: 102

Re: how to make an array by function and by local variable of the function

notice that there is a global variable named n
That gets overwritten with 0 in the scope of your function. And every variable you define inside of the function will be discarded because of the endlocal command at the end.
But the result is incorrect
What would be the result you expect?

Steffen