Search found 4566 matches

by aGerman
25 Dec 2011 12:55
Forum: DOS Batch Forum
Topic: How can I remove trailing space(s) between text and CR/LF ?
Replies: 13
Views: 17219

Re: How can I remove trailing space(s) between text and CR/L

I like your RTRIM macro much better, but I don't see how my proposal strips carets. Hmm ... that's what I get: > rtrim "hello^ world! " before="hello world " after="hello world" > rtrim "hello^world! " before="helloworld " after="helloworld&quo...
by aGerman
25 Dec 2011 10:41
Forum: DOS Batch Forum
Topic: How can I remove trailing space(s) between text and CR/LF ?
Replies: 13
Views: 17219

Re: How can I remove trailing space(s) between text and CR/L

Merry Christmas everyone! @Dave Good idea, but my first tests showed that single carets are removed @Alan To be honest I would avoid Batch in this case. Other languages could solve your Lf problem and the right-trimming at once. Tell me if you would be interested in. However, this could remove at le...
by aGerman
24 Dec 2011 08:08
Forum: DOS Batch Forum
Topic: Can I get individual "unix" lines read by set /P "LN="
Replies: 4
Views: 6283

Re: Can I get individual "unix" lines read by set /P "LN="

Hi Alan. Obviously SET /P needs CrLf to separate the lines. I'm virtually certain you can't change that behaviour (except you would develop your own cmd.exe ). You could return to FOR loops, like ... @echo off & setlocal DisableDelayedExpansion SET "file=Test2.ini" set /a n=0 for /f &q...
by aGerman
24 Dec 2011 07:55
Forum: DOS Batch Forum
Topic: IP address
Replies: 1
Views: 2563

Re: IP address

How to locate the Ip address of the sender in an email header? You wanna do that using Batch I have found the IP address after studying how to read the email header, however when i tried to locate the IP address, the address is somewhere in New Jersey. Maybe im reading it wrong or maybe there is sp...
by aGerman
23 Dec 2011 06:05
Forum: DOS Batch Forum
Topic: copy mulitiple files an once
Replies: 4
Views: 5617

Re: copy mulitiple files an once

That's too less information. You could use wildcards like asterisks. You could use different commands with different options, such like COPY, XCOPY and ROBOCOPY. You could process the DIR command in a FOR /F loop. You could apply FIND or FINDSTR to the files or to the output of DIR. It depends on wh...
by aGerman
21 Dec 2011 15:01
Forum: DOS Batch Forum
Topic: How to search and replace a string
Replies: 13
Views: 12474

Re: How to search and replace a string

Delayed variable expansion may help.

Code: Select all

@echo off
set "envr1=random%%random%%random"

echo %envr1%

setlocal enabledelayedexpansion
for /f "delims=" %%i in ("!envr1:%%=~!") do (endlocal &set "envr1=%%i")

echo %envr1%

pause

Regards
aGerman
by aGerman
21 Dec 2011 14:01
Forum: DOS Batch Forum
Topic: Get last string after delimiter FOR /F
Replies: 3
Views: 13488

Re: Get last string after delimiter FOR /F

Try:

Code: Select all

set "myPath=C:\Users\[username]\Desktop\Example Folder\Example Folder 2"
for /f "delims=" %%i in ("%myPath%") do set "myFolder=%%~nxi"
echo "%myFolder%"

Regards
aGerman
by aGerman
21 Dec 2011 12:00
Forum: DOS Batch Forum
Topic: Decoding password letters.
Replies: 4
Views: 5744

Re: Decoding password letters.

The program is processing the virtual key codes but it is displaying asterisks instead. You can't decode these asterisks because they are not encoded :wink:

Regards
aGerman
by aGerman
21 Dec 2011 11:52
Forum: DOS Batch Forum
Topic: why is this FOR doing this?
Replies: 22
Views: 26777

Re: why is this FOR doing this?

taripo wrote:I just tried making a cmd.bat in \windows\system32 that could go to a directory, but start..run..CMD<ENTER> doesn't run the bat.

Save it as cmd_.bat and run CMD_ (or choose whatever name ... )

Regards
aGerman
by aGerman
21 Dec 2011 11:44
Forum: DOS Batch Forum
Topic: batch file every second Alt+F3
Replies: 2
Views: 5202

Re: batch file every second Alt+F3

tomboman wrote:Hi, I want to make a batch file that press every second the Alt + F3 combination.

No way.

tomboman wrote:can someone help me?

Not sure. Have a look at SendKeys in VBScript or JScript. But it's not applicable to a lot of computer games (the developers already know such tricks).

Regards
aGerman
by aGerman
17 Dec 2011 08:22
Forum: DOS Batch Forum
Topic: Error with conditional command use
Replies: 1
Views: 3563

Re: Error with conditional command use

Try something like that: @echo off &setlocal enableExtensions disableDelayedExpansion ::::::::: create macro "$stop" ::::::::: set LF=^ set ^"\n=^^^%LF%%LF%^%LF%%LF%^^"&rem TWO EMPTY LINES ABOVE REQUIRED! for /f %%a in ('"prompt $H$S &echo on &for %%b in (1) ...
by aGerman
17 Dec 2011 08:01
Forum: DOS Batch Forum
Topic: How to create a video cd which cannot be duplicated?
Replies: 1
Views: 2066

Re: How to create a video cd which cannot be duplicated?

I'm not sure whether you realized that you asked that in a Windows Batch forum :? All I can say is there is no way using batch.

Regards
aGerman
by aGerman
15 Dec 2011 10:36
Forum: DOS Batch Forum
Topic: if there is more then 1 file then delete old files
Replies: 2
Views: 2620

Re: if there is more then 1 file then delete old files

Someting like that?

Code: Select all

dir /a-d /b /s "d:\bacup\*" >nul 2>&1 ||goto :eof

Regards
aGerman
by aGerman
15 Dec 2011 10:30
Forum: DOS Batch Forum
Topic: Can't remove <space> FOR delimiter
Replies: 1
Views: 2630

Re: Can't remove <space> FOR delimiter

It's not a problem of your FOR loop but it's a problem of how you call your sub routine. You have to enclose arguments with spaces in quotation marks. @echo off &setlocal set "_InputFile=test.txt" For /F "tokens=1-5 delims=," %%I IN (%_InputFile%) DO ( ECHO %%I Call :process_...
by aGerman
11 Dec 2011 14:52
Forum: DOS Batch Forum
Topic: use ie to google all running tasks (for tokens delims)
Replies: 3
Views: 5197

Re: use ie to google all running tasks (for tokens delims)

Be careful! If you run approx. 100 instances of Internet Explorer your machine will probably freeze because of 100% CPU use.

Regards
aGerman