Search found 1041 matches

by jeb
02 Apr 2010 00:48
Forum: DOS Batch Forum
Topic: Error in If logic
Replies: 4
Views: 4791

Re: Error in If logic

Hello venkimuck, 1) The first if condition itself is not true, so it should not even go into the ( section under the if condition. That's is the problem, it's not important if the first if condition is true. The whole section is expanded, and the syntax must be correct. Try if "%var1:~1,8%"...
by jeb
02 Apr 2010 00:39
Forum: DOS Batch Forum
Topic: Find an IP address
Replies: 4
Views: 5460

Re: Find an IP address

hi locbtran,

try only ipconfig

jeb
by jeb
01 Apr 2010 13:48
Forum: DOS Batch Forum
Topic: Error in If logic
Replies: 4
Views: 4791

Re: Error in If logic

Hello venkimuck,

you got this error if var1 is empty/not exist.

The batch logic expands

Code: Select all

if %var1:~1,8% NEQ Disabled (

to

Code: Select all

if ~1,8 NEQ Disabled (


hope it helps
jeb
by jeb
01 Apr 2010 13:06
Forum: DOS Batch Forum
Topic: time calculation
Replies: 1
Views: 2942

Re: time calculation

Hi eamjam, use the %time% and calculate the seconds since 0:00. Sample. call :timeToMs ms_start "%start%" call :timeToMs ms_end "%end%" echo %start%=%ms_start%ms echo %end%=%ms_end%ms set /a diff_ms=ms_end-ms_start echo diff=%diff_ms%ms goto:eof ::::::::::::::::::. :timeToMs <res...
by jeb
01 Apr 2010 12:57
Forum: DOS Batch Forum
Topic: Batch Countdown
Replies: 1
Views: 4882

Re: Batch Countdown

Hi HKX, a little bit tricky. The count of seconds is simple, look at the dos function library. http://www.dostips.com/DtCodeCmdLib.php#sleep Displaying the Text "Services will be automatically stop after X seconds.." always at the same position can be done 1. Simple with CLS, clear the com...
by jeb
01 Apr 2010 12:13
Forum: DOS Batch Forum
Topic: Find an IP address
Replies: 4
Views: 5460

Re: Find an IP address

Hi locbtran,

you can use ipconfig.
But in batch files you can get trouble if you are running XP, because Microsoft does not know how line endings should work.
Ipconfig print LF CR instead of CR LF.

Under Vista it works correct.

jeb
by jeb
20 Feb 2010 10:11
Forum: DOS Batch Forum
Topic: On Exit Do Command
Replies: 18
Views: 17883

Re: On Exit Do Command

Hello, I suppose you get your money per line @ECHO OFF TITLE Keyboard Simulator MODE CON cols=41 lines=5 :loop call :ShowKeyboard %ERRORLEVEL% CHOICE /C 1234567890qwertyuiopasdfghjklzxcvbnm /N > nul goto :loop :::::::::::: :ShowKeyboard <mark> Shows a standard english keyboard :: <mark> Marks the ke...
by jeb
05 Dec 2009 05:40
Forum: DOS Batch Forum
Topic: Help with parsing log file
Replies: 2
Views: 4187

Hello sfgman63, try it with something like call :TestFile file1.log call :TestFile file2.log goto :eof ::::::::::::: :TestFile setlocal findstr "FINAL- Overall PASS" "%~1" > NUL echo %errorlevel% ( endlocal goto :eof ) Findstr will result in an errorlevel 0, if the string...
by jeb
04 Dec 2009 05:35
Forum: DOS Batch Forum
Topic: Using special characters when renaming file
Replies: 2
Views: 4265

Hello keneo, you can use chr.bat to build a file with ascii-characters (in hexformat) call chr.bat 41 creates a chr.tmp file with one "B" @ECHO off setlocal ( echo a100 echo db %~1 echo. echo rcx echo 1 echo w echo q ) | debug chr.tmp > NUL for /f "tokens=*" %%l in (c...
by jeb
31 Oct 2009 09:24
Forum: DOS Batch Forum
Topic: Can I have 2-3 letters as Delimeter?
Replies: 7
Views: 14973

Hi arkamath, a general solution for splitting a string at the first delim, working with more than one char. call :split "abcdefXYZghijXYZklmnop" "XYZ" PrefixVar PostfixVar echo '%PrefixVar%' '%PostfixVar%' goto :eof :::::::::::::: :split <string> <delim> <prefixResultVar> <postfi...
by jeb
10 Jul 2009 03:24
Forum: DOS Batch Forum
Topic: Listing files with exclusion
Replies: 13
Views: 15507

Hi gusarta, I tried it with the Xcopy command, because it has the option to exclude files and the option to do nothing @echo off rem *** Folder (with subfolder) to count set folder="C:\temp" rem * Build the file exclude list echo .mp3 > exc.tmp echo .tmp >> exc.tmp set /a totalSize...
by jeb
10 Jul 2009 01:45
Forum: DOS Batch Forum
Topic: Im trying to batch multiple web pages & office documents
Replies: 5
Views: 8006

Hi ScumPuppy, I tried this "%ProgramFiles%\microsoft office\office\winword" myDoc_eins.doc "%ProgramFiles%\microsoft office\office\winword" myDoc_zwei.doc or "%ProgramFiles%\microsoft office\office\winword" myDoc_eins.doc myDoc_zwei.doc Ok it opens both documents at the...
by jeb
09 Jul 2009 07:40
Forum: DOS Batch Forum
Topic: Im trying to batch multiple web pages & office documents
Replies: 5
Views: 8006

Hi ScumPuppy, I suppose there is no simple way. Your problem is, that you only want to wait until the program is opened not until it is closed. Therefore the "start /wait" can't work. The solution have to be start the program, and the poll until it is opened completly. The polling could be...
by jeb
26 Jan 2009 16:39
Forum: DOS Batch Forum
Topic: Extract rows from text file and slight reformatting
Replies: 10
Views: 13399

Hi NTYeader, it's nice that your code works finally. Your minor problem is not a problem. setlocal ENABLEDELAYEDEXPANSION for /l %%d in (1,1,30) do ( REM ensures two digits if %%d lss 10 ( set dd=0%%d ) else ( set dd=%%d ) echo dd=!dd! ) Works fine. Or you can solve i...
by jeb
20 Jan 2009 09:20
Forum: DOS Batch Forum
Topic: How to block the first or the last line of the output screen
Replies: 1
Views: 4676

Hi tanoloco, similiar to the Problem from ntyReader, but a bit easier, because of the fixed count of one line removing from the tail and the head. @ECHO off setlocal ENABLEDELAYEDEXPANSION set /a show=0 for /F "tokens=* skip=1" %%r in (test.txt) do ( if !show!==1 echo !saveLine...