Search found 4506 matches

by aGerman
22 Oct 2011 05:28
Forum: DOS Batch Forum
Topic: PLEASE HELP ME WITH "FOR" (I need to know!)
Replies: 3
Views: 5407

Re: PLEASE HELP ME WITH "FOR" (I need to know!)

trebor68's examples are made to use them directly in a cmd window. If you need to use them in a batch file you will have to double the percent signs of the FOR variables (eg. %a --> %%a). If you want to work with FOR /F you primarily will have to learn how to use tokens and delims . Perhaps this bat...
by aGerman
16 Oct 2011 09:13
Forum: DOS Batch Forum
Topic: help!
Replies: 5
Views: 5604

Re: help!

What about >"my.log" findstr /msc:"MYWORD1 MYWORD2" "C:\wherever\*.txt" Note that it's searching in a case-sensitive manner (that could be a problem because it seems your caps lock key is out of order). Otherwise you have to include the /i option ( /imsc: ). Regards aGe...
by aGerman
15 Oct 2011 07:25
Forum: DOS Batch Forum
Topic: Need your input here guys [updated]
Replies: 5
Views: 4402

Re: Need your input here guys

would you mind explaining that to me? It's simple. Since the value is always in the next line I search for "..Document-Number:" and if it was found I set the value of variable found to 1. Now it iterates to the next line. Because found is 1 this line will be outputted. At the same time I ...
by aGerman
14 Oct 2011 13:10
Forum: DOS Batch Forum
Topic: Getting Results From VBScript
Replies: 4
Views: 7995

Re: Getting Results From VBScript

Both scripts are working for me and actually I have no clue why they won't work for you.

Regards
aGerman
by aGerman
14 Oct 2011 12:57
Forum: DOS Batch Forum
Topic: Need your input here guys [updated]
Replies: 5
Views: 4402

Re: Need your input here guys

Is there a way I can extract that value? Value? Which of them? There are 422 Document-Number s in your file. @echo off &setlocal enabledelayedexpansion set /a found=0 for /f "usebackq tokens=* delims=" %%i in ("SCOL000016_ln.br3") do ( if !found!==1 ( echo %%i set /a found=0...
by aGerman
13 Oct 2011 13:19
Forum: DOS Batch Forum
Topic: Need batch file to turn-off service based on Wi-fi connected
Replies: 1
Views: 1964

Re: Need batch file to turn-off service based on Wi-fi conne

It's just an idea and I'm not sure whether it will work in your case. For that reason you should execute RASDIAL in a CMD window and have a look at the output: - if you're NOT connected it should display 2 lines - if you're connected it should display 3 lines with the connection name in the 2nd line...
by aGerman
13 Oct 2011 10:12
Forum: DOS Batch Forum
Topic: Listing all drives and making user select one
Replies: 6
Views: 4962

Re: Listing all drives and making user select one

You could use the WMIC command. @echo off setlocal enabledelayedexpansion set /a n=0 echo Number Drive Name for /f "tokens=2 delims==" %%i in ('wmic logicaldisk get name /value') do ( set /a n+=1 echo !n! %%i set "d_!n!=%%i" ) :loop echo( set "num=" set /p "num=Cho...
by aGerman
08 Oct 2011 14:54
Forum: DOS Batch Forum
Topic: errorlevel in a for
Replies: 4
Views: 3853

Re: errorlevel in a for

As far as I figured out the command line inside of a FOR /F loop is either executed in another thread of the same cmd instance (in case of internal commands) or it is executed in another instance of cmd. However it seems there is no chance to pass the errorlevel to the parent process.

Regards
aGerman
by aGerman
08 Oct 2011 10:26
Forum: DOS Batch Forum
Topic: Path inclusion in Dir
Replies: 16
Views: 10659

Re: Path inclusion in Dir

Write an echo on as next line.

Regards
aGerman
by aGerman
08 Oct 2011 09:08
Forum: DOS Batch Forum
Topic: Opening and working in
Replies: 4
Views: 3826

Re: Opening and working in

Have a look at the START command.

Regards
aGerman
by aGerman
08 Oct 2011 09:06
Forum: DOS Batch Forum
Topic: findstr help!
Replies: 3
Views: 3301

Re: findstr help!

Have a look at the substitude function.
Also there are a lot of examples you can find in this forum.

Regards
aGerman
by aGerman
08 Oct 2011 08:57
Forum: DOS Batch Forum
Topic: can you set multiple lines into one variable?
Replies: 4
Views: 4182

Re: can you set multiple lines into one variable?

The ! replaces the % for environment variables if enabledelaiedexpansion was set and you have to expand this variable more than once in a command line or a block.

Regards
aGerman
by aGerman
08 Oct 2011 08:54
Forum: DOS Batch Forum
Topic: How to set switches in a batch file
Replies: 4
Views: 3815

Re: How to set switches in a batch file

Again replace the REM line with your code which should be executed if the batch file was called with /v as first argument.

Regards
aGerman
by aGerman
08 Oct 2011 08:51
Forum: DOS Batch Forum
Topic: How to check for text in a text document
Replies: 3
Views: 3388

Re: How to check for text in a text document

The REM line is only a remark/comment. You have to replace it with your code which should be executed if "print" was found in "test.txt".

Regards
aGerman
by aGerman
08 Oct 2011 08:48
Forum: DOS Batch Forum
Topic: How to use "find" results as variables
Replies: 4
Views: 3905

Re: How to use "find" results as variables

No idea what exactly you are looking for, but you should have a look at the help of find (find /?) and findstr (findstr /?).

Type for /? in the command window and hit Enter to get more info or have a look at the Command Index.

Regards
aGerman