Search found 7 matches

by probyn
28 Jul 2013 22:16
Forum: DOS Batch Forum
Topic: String Encryption (encoding)
Replies: 28
Views: 39985

Re: String Encryption (encoding)

OK, I took a look at my Enigma4 and I actually need to post two batch files. ≡≡≡≡≡begin c:\Cmd\test\enigma4.cmd≡≡≡≡≡ 001. @echo off 002. setlocal enabledelayedexpansion 003. 004. :function 005. set /p op="Enter function: E(ncrypt) or D(ecrypt) ==> " 006. if not defined op goto :EOF 007. se...
by probyn
28 Jul 2013 19:34
Forum: DOS Batch Forum
Topic: String Encryption (encoding)
Replies: 28
Views: 39985

Re: String Encryption (encoding)

I admit it's definitely convoluted. It's all fresh off the presses in the "proof of concept" / "hooray everything works" stage. I was so surprised that I couldn't find any real good examples of batch file cryptography that I figured I'd code up a few to share. I haven't had the ...
by probyn
17 Jul 2013 17:10
Forum: DOS Batch Forum
Topic: A different method to trim spaces from a string
Replies: 16
Views: 21731

Re: A different method to trim spaces from a string

[quote="penpen"]@probyn I've found an issue when executing: Z:\>SET TEST= test Z:\>SET TEST_A= test a Z:\>safeTrim TEST Z:\>SET TEST TEST=test a TEST_A= test a This could be fixed by adding a safe if "%1" == "TEST", also a %1 gatekeeper should be performed, so the whole...
by probyn
16 Jul 2013 16:36
Forum: DOS Batch Forum
Topic: A different method to trim spaces from a string
Replies: 16
Views: 21731

Re: A different method to trim spaces from a string

@Samir It seems to right trim only: Z:\>for %f in (" test test test ") do echo "%~nf" " test test test" @probyn This woorks very good, but is unsafe: trim asdad asd ^& echo Leak Maybe i am a little bit too mistrustful, but this is my maxime on external input. penpe...
by probyn
16 Jul 2013 13:19
Forum: DOS Batch Forum
Topic: A different method to trim spaces from a string
Replies: 16
Views: 21731

Re: A different method to trim spaces from a string

I found a really quick and dirty way to trim spaces from a for variable by using %~nF. Even though ~n is reserved for filenames, it does a great job of stripping out white space. This one-liner will take care of both left and right trimming of spaces: ----------begin screen capture--------- C:\CMD>...
by probyn
07 Jul 2013 14:06
Forum: DOS Batch Forum
Topic: Extracting required columns from the file
Replies: 27
Views: 23772

Re: Extracting required columns from the file

You have received some excellent replies. Here is another way to accomplish your stated result. (Tested on WinXP under WinVPC on Win7 Pro host.) @echo off & setlocal enabledelayedexpansion for /f "tokens=2,4-6" %%K in ( 'findstr "process behind" x:\yourpath\yourfile.log' ) do...
by probyn
23 May 2013 20:10
Forum: DOS Batch Forum
Topic: Leading Spaces Batch File
Replies: 9
Views: 13357

Re: Leading Spaces Batch File

All that 'set /p' stuff is too complicated. Why not keep it simple? @echo off setlocal enabledelayedexpansion for /f "tokens=*" %%a in (fruit.txt) do set list=!list!,%%a echo/You have or like or whatever the following fruit[: ]%list:~1%>>output.txt Phil Robyn p r o b y n a t b e r k e l e ...