Search found 43 matches
- 24 Apr 2012 15:22
- Forum: DOS Batch Forum
- Topic: Encoding / Decoding
- Replies: 8
- Views: 10727
Re: Encoding / Decoding
Yes, not a difficult crack at all I just wrote it for a little challenge
- 23 Apr 2012 21:27
- Forum: DOS Batch Forum
- Topic: Encoding / Decoding
- Replies: 8
- Views: 10727
Re: Encoding / Decoding
decode example.bat: @echo off setlocal enabledelayedexpansion for /f "tokens=* delims=" %%a in (message.txt) do set "message=%%a" set /p code=Code: call :decode string "%message%" "%code%" echo %string% pause goto :eof :decode rem Decodes a string using a code...
- 23 Apr 2012 21:23
- Forum: DOS Batch Forum
- Topic: Encoding / Decoding
- Replies: 8
- Views: 10727
Encoding / Decoding
I just thought I would share this concept that I used to encode / decode text - nothing fancy, but I thought the algorithm was interesting (it counts in different bases for each digit of the 4 digit "code" to encode the letters) and it is fairly quick as well. Though you may find the code ...
- 20 Apr 2012 20:14
- Forum: DOS Batch Forum
- Topic: Sorting list in alphabetical order?
- Replies: 4
- Views: 3881
Re: Sorting list in alphabetical order?
Thank you very much Aacini and foxidrive Problem solved
- 19 Apr 2012 20:22
- Forum: DOS Batch Forum
- Topic: Play a random media file
- Replies: 10
- Views: 6447
Re: Play a random media file
For one thing, your formula returns numbers starting at 0, not 1. Otherwise, it should work well enough for "small" ranges (relative to 2^15 = 32,768) - but completely fail for wider (%max%-%min%) ranges > 32,768. My formula should return integers from 1-%lines% not including 0 Good to kn...
- 19 Apr 2012 20:10
- Forum: DOS Batch Forum
- Topic: Sorting list in alphabetical order?
- Replies: 4
- Views: 3881
Re: Sorting list in alphabetical order?
for /f "tokens=* delims=" %%a in ('sort <myfile.txt') do echo %%a Output: < was unexpected at this time. C:\Users\User\Desktop> How could I accomplish this in this format?? The file is not organized in a way that would generate suitable output from 'sort <myfile.txt' so I was hoping I cou...
- 19 Apr 2012 17:51
- Forum: DOS Batch Forum
- Topic: Play a random media file
- Replies: 10
- Views: 6447
Re: Play a random media file
Could you explain the line:
I typically use:
which in this case I think would be:
Just wondering the difference between the two
Code: Select all
set /a "rand=(%random%*%lines%)/32768+1"
I typically use:
Code: Select all
set /a "rand=(%random% %%(%max%-%min%))+%min%"
which in this case I think would be:
Code: Select all
set /a "rand=%random% %% (%lines%)"
Just wondering the difference between the two
- 19 Apr 2012 17:40
- Forum: DOS Batch Forum
- Topic: Sorting list in alphabetical order?
- Replies: 4
- Views: 3881
Sorting list in alphabetical order?
I have a text file that I would like to be sorted (or just displayed) in alphabetical order
Currently I am using 'for /f "tokens=* delims=" %%a in (myfile.txt) do echo %%a'
I simply want the output alphabetical, any solution is fine
Currently I am using 'for /f "tokens=* delims=" %%a in (myfile.txt) do echo %%a'
I simply want the output alphabetical, any solution is fine
- 17 Apr 2012 20:27
- Forum: DOS Batch Forum
- Topic: FINDSTR (Find & Replace) question...
- Replies: 10
- Views: 15375
Re: FINDSTR (Find & Replace) question...
:substitute OldStr NewStr File -- substitutes a string in a text file :: -- OldStr [in] - string to be replaced :: -- NewStr [in] - string to replace with :: -- File [in] - file to be parsed :$created 20060101 :$changed 20101122 :$categories FileManipulation :$source http://www.dostips.com SETLOCAL...
- 11 Apr 2012 16:00
- Forum: DOS Batch Forum
- Topic: Variable won't expand
- Replies: 8
- Views: 5559
Re: Variable won't expand
I found and fixed this error last night, before having read liviu's post, but I suppose that is irrelevant
Thank you for your time
Thank you for your time
- 10 Apr 2012 20:09
- Forum: DOS Batch Forum
- Topic: Variable won't expand
- Replies: 8
- Views: 5559
Re: Variable won't expand
This also fails, with exact same output @echo off set "string1= string1" set "string2= string2 " set "string3= string3" echo "%string1%" echo "%string2%" echo "%string3%" call :lTrim string1 "%string1%" " " call :lTrim s...
- 10 Apr 2012 20:05
- Forum: DOS Batch Forum
- Topic: Variable won't expand
- Replies: 8
- Views: 5559
Re: Variable won't expand
I will try using a section marker and another call statement though
- 10 Apr 2012 20:04
- Forum: DOS Batch Forum
- Topic: Variable won't expand
- Replies: 8
- Views: 5559
Re: Variable won't expand
I guess I'll have to try your suggestion of making a new section, the same output was generated Output: " string1" " string2 " " string3" "str:~1,17 " "str:~1,14 " "str:~1,21 " Press any key to continue . . . Though now that I think about i...
- 10 Apr 2012 18:19
- Forum: DOS Batch Forum
- Topic: Variable won't expand
- Replies: 8
- Views: 5559
Variable won't expand
So I have created my own left trim algorithm, (follows the same principles of the rTrim function in the library) but it seems that the variable !str:~1,%len%! never expands properly. If I replace the variable with a hard-coded value, the function works just fine, but I would like to have it to ensur...
- 09 Apr 2012 18:37
- Forum: DOS Batch Forum
- Topic: Save to a log file.
- Replies: 3
- Views: 4137
Re: Save to a log file.
I re-wrote your code as the following, it is untested though With something like this it is easiest to just put a character you know wont be in the password or username (I used ';', you can change if you want) and use it as a delimeter to seperate them, thats basically all I did also, you didn't nee...