Search found 76 matches

by timbertuck
28 Nov 2012 11:59
Forum: DOS Batch Forum
Topic: RCG needs help with possible poison characters (getting clos
Replies: 46
Views: 39270

Re: RCG needs help with possible poison characters (getting

it still does not work. this is due to endlocal being run?? You could see that with my example. I mentioned earlier that you will have trouble using the strings in a batch file - with all the poison characters. Your response was that they are only going to the screen. *shrug* but im confused... the...
by timbertuck
28 Nov 2012 11:23
Forum: DOS Batch Forum
Topic: RCG needs help with possible poison characters (getting clos
Replies: 46
Views: 39270

Re: RCG needs help with possible poison characters (getting

it still does not work. this is due to endlocal being run?? automatically at batch end, so it won't save the vars. the workaround is endlocal &set var=%var% and this works with other batch programs, why not here? so i distilled the routine further and added an echo to see if it was saving right....
by timbertuck
26 Nov 2012 12:18
Forum: DOS Batch Forum
Topic: RCG needs help with possible poison characters (getting clos
Replies: 46
Views: 39270

Re: RCG needs help with possible poison characters (getting

...do it this way or like this way? can you help out? if /i "%1"=="/s" ( endlocal &for /l %%A in (999,-1,1) do (if defined $string[%%A] set "$string[%%A]=!lastval[%%A]!") Remove the endlocal while testing - I don't know what the scope is there. I'd also remove this...
by timbertuck
25 Nov 2012 09:48
Forum: DOS Batch Forum
Topic: RCG needs help with possible poison characters (getting clos
Replies: 46
Views: 39270

Re: RCG needs help with possible poison characters (getting

thanks foxidrive for that additional solution... i always wondered how to do the ascii key to convert, that opens things up for me with random code generator, could make one that just does everything but the keyboard keys... interesting project but can you help me with this? EDIT this works, but get...
by timbertuck
24 Nov 2012 14:40
Forum: DOS Batch Forum
Topic: RCG needs help with possible poison characters (getting clos
Replies: 46
Views: 39270

Re: RCG needs help with possible poison characters (getting

its not that im not going to use them, its just that the batch file only has to emit the char's to the screen. i cut and paste the result and use it as a random passcode for programs that require it (like irfanview's SaveAsPDF, you have to put in a passcode during the Save or it makes a random one ...
by timbertuck
24 Nov 2012 14:26
Forum: DOS Batch Forum
Topic: RCG needs help with possible poison characters (getting clos
Replies: 46
Views: 39270

Re: RCG needs help with possible poison characters (getting

In that case, I'd prefer writing to a file and copy from notepad. >file.TMP ( echo.result ) start "" /wait notepad.EXE "file.TMP" del file.TMP Or even better copy to clipboard directly from batch. i was trying to keep this lightweight without resorting to using files so i have t...
by timbertuck
24 Nov 2012 14:15
Forum: DOS Batch Forum
Topic: RCG needs help with possible poison characters (getting clos
Replies: 46
Views: 39270

Re: RCG needs help with possible poison characters (getting

how can i get this to work? code working if /i "%1"=="/s" ( endlocal set "$string[10]=%lastval[10]%" set "$string[9]=%lastval[9]%" set "$string[8]=%lastval[8]%" set "$string[7]=%lastval[7]%" set "$string[6]=%lastval[6]%" set "...
by timbertuck
22 Nov 2012 09:58
Forum: DOS Batch Forum
Topic: how to extract only Capital Letters from file
Replies: 10
Views: 9228

Re: how to extract only Capital Letters from file

Enclose the loop into another pair of parentheses to catch the outgoing stream and redirect it into your temporary file. @echo off &setlocal >"tmp.tmp" ( for /f "delims=" %%i in ('findstr "\<[ABCDEFGHIJKLMNOPQRSTUVWXYZ-]*\>" "TESTfile.txt"') do ( set &quo...
by timbertuck
22 Nov 2012 09:21
Forum: DOS Batch Forum
Topic: Send "Backspace" Key in Batch
Replies: 7
Views: 22765

Re: Send "Backspace" Key in Batch

The FOR IN() clause commands are executed by a new CMD.EXE process. They are parsed all at once as a single block of commands. ECHO is initially off when the commands are executed. We need ECHO ON to get the prompt output for the REM command. The code block turns ECHO ON, but the change in state is...
by timbertuck
21 Nov 2012 14:47
Forum: DOS Batch Forum
Topic: how to extract only Capital Letters from file
Replies: 10
Views: 9228

Re: how to extract only Capital Letters from file

' I tried to formulate an answer, but gave up as I found too little information provided in the original post. People have no clue which OS you are on nor whether empty lines need to be preserved On windows 7 64bit. no to the empty lines being preserved. the original file is 28mb. if you want i can...
by timbertuck
21 Nov 2012 14:42
Forum: DOS Batch Forum
Topic: how to extract only Capital Letters from file
Replies: 10
Views: 9228

Re: how to extract only Capital Letters from file

I am confused why you are trying to use a conditional execution to output the WORD variable to a temp file. That code will only execute when the previous command did not execute successfully. im not sure either now that i look at it. what i wanted was to echo the CAP letters (WORDS actually) into a...
by timbertuck
21 Nov 2012 14:00
Forum: DOS Batch Forum
Topic: Send "Backspace" Key in Batch
Replies: 7
Views: 22765

Re: Send "Backspace" Key in Batch

Ed's code can be simplified. No need for delayed expansion, # symbols, DELIMS option, ECHO ON, or substring. Below is effectively the same code, as I like to write it. @echo off setlocal :: Define BS to contain a backspace for /f %%a in ('"prompt $H&for %%b in (1) do rem"') do set &qu...
by timbertuck
21 Nov 2012 13:41
Forum: DOS Batch Forum
Topic: how to extract only Capital Letters from file
Replies: 10
Views: 9228

Re: how to extract only Capital Letters from file

FINDSTR supports regular expressions. The following should work @echo off &setlocal for /f "delims=" %%i in ('findstr "\<[ABCDEFGHIJKLMNOPQRSTUVWXYZ-]*\>" "test.txt"') do ( set "ln=%%i" setlocal EnableDelayedExpansion for %%j in (!ln!) do ( endlocal set &...
by timbertuck
21 Nov 2012 13:38
Forum: DOS Batch Forum
Topic: how to extract only Capital Letters from file
Replies: 10
Views: 9228

Re: how to extract only Capital Letters from file

@echo off setlocal EnableDelayedExpansion set upcaseLetters=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z for /F "delims=" %%a in (testfile.txt) do ( for %%b in (%%a) do ( set "word=%%b" for %%c in (%upcaseLetters%) do set "word=!word:%%c=%%c!" if "!word!&qu...
by timbertuck
17 Nov 2012 11:05
Forum: DOS Batch Forum
Topic: how to extract only Capital Letters from file
Replies: 10
Views: 9228

how to extract only Capital Letters from file

i have a test file that contains the following as an example testfile A some text and some more text B; B-C;DE some more text lots of text E F other text text text text and need it to output only the CAPS words but not the associated text A B B-C DE E F so the file can contain a single CAP word, two...