Search found 923 matches

by jeb
02 Jul 2008 08:34
Forum: DOS Batch Forum
Topic: Setting variable values and logging to a file
Replies: 9
Views: 8152

Hi, nice problem, but where is the problem? I tried this and it works REM *** Update log file and delete any tmp files and clean up @echo off setlocal if exist "deletelist.tmp" goto :doIt goto :eof :doIt set /a Q20=0 echo Q20=%Q20% set /a DATA=0 echo DATA=%DATA% echo File deletions started...
by jeb
24 Jun 2008 16:13
Forum: DOS Batch Forum
Topic: Need really simple code
Replies: 1
Views: 3677

Hi, build a file named IPList.txt like 192.168.0.1 10.0.47.11 10.0.08.15 ... Read the file and get the hostname @echo off setlocal enabledelayedextensions for /F "tokens=*" %%i IN (IPlist.txt) DO ( echo IP is %%i rem do something with this ip, like ping %%i rem echo the name pi...
by jeb
19 Jun 2008 00:08
Forum: DOS Batch Forum
Topic: How can I get the path to the batch file being run?
Replies: 1
Views: 3434

Hi Chris,

this should work

Code: Select all

echo path to %0 is %~dp0


jeb
by jeb
15 Jun 2008 00:18
Forum: DOS Batch Forum
Topic: challenge: a dos shell stopwatch
Replies: 5
Views: 7692

Hi davep, In my country the decimal point is a comma, thats not really a problem. But the rest can't work. Take the time at " 9:24:02,56" and " 9:25:02,56" this should result in 60.0 seconds, but your code results in 100.0 seconds. Next problem, try it with "0:28:24,56"...
by jeb
29 May 2008 13:56
Forum: DOS Batch Forum
Topic: script to rename file based on a string in the first line
Replies: 1
Views: 3651

Hi Ikea,

take a look at the for /f "tokens=..." command, that should do the work for you.

jeb
by jeb
29 May 2008 13:42
Forum: DOS Batch Forum
Topic: Any one-liner script to determine leap year?
Replies: 4
Views: 6946

Hi Frank,

the 'set' command supports '&' "bitwise and", "| bitwise or"
but the & is also the delimeter for the next command on one line.

like

Code: Select all

set /a var=1 & echo hello


same for the pipe '|'

therefore you need to escape them with '^'

jeb
by jeb
25 May 2008 15:36
Forum: DOS Batch Forum
Topic: map and lookup - please explain
Replies: 2
Views: 4299

Hi Frank, Bu what is the reason for 'CALL'? What will be different if withou using CALL? Why '&rem.'? 1. Difference between "Call Set" and "Set" CALL SET v=%%map:*%v%-=%% the call results in a double expansion of the line. The first expansion results in (with v=sat) v=%map:*s...
by jeb
25 May 2008 15:10
Forum: DOS Batch Forum
Topic: Any one-liner script to determine leap year?
Replies: 4
Views: 6946

Hi Frank,

in a batchfile this is a solution for the years from 1901-2099

Code: Select all

set /a leapyear=! (%year% %% 4 )


obviously :wink: this is the full solution

Code: Select all

set /a leapyear=((!(%year%%%400))^|!(!(%year%%%100)))^&!(%year%%%4)


jeb
by jeb
25 May 2008 06:16
Forum: DOS Batch Forum
Topic: Batch routine to change file names
Replies: 2
Views: 4615

Hi Nelson, begin with this @echo off setlocal enableextensions setlocal enabledelayedexpansion set srcPath=c:\temp\hund set prefix=LLL- echo %prefix% for %%a in (%srcPath%\*.*) do ( set oldName=%%~nxa set newName=%%~dpa%prefix%!oldName:~1! echo ren !oldName! !newName! ) jeb
by jeb
23 May 2008 11:41
Forum: DOS Batch Forum
Topic: Elementary file rename problem.
Replies: 1
Views: 3525

Hi,

I suppose you can't solve it with xcopy or copy,
but try this

Code: Select all

@echo off
setlocal

set srcPath=c:\temp\hund
set prefix=100
echo %prefix%

for %%a in (%srcPath%\*.*) do echo ren %%a %%~dpa%prefix%%%~nxa


jeb
by jeb
12 May 2008 15:56
Forum: DOS Batch Forum
Topic: Batch file for mp3 encoding
Replies: 2
Views: 4362

Hi,

Code: Select all

for %%a in (*.wav) DO lame.exe /myoptions %%a %%~na.mp3


should work.

The trick is %%~n which results in the filename (without) extension.

jeb
by jeb
12 May 2008 15:36
Forum: DOS Batch Forum
Topic: Make a script independent of the System drive letter
Replies: 1
Views: 3364

Hi Budhax, Is this method enough and safe to make the script independent of the "System drive letter"? yes and no. yes it is enough to independent of the drive letter. but it's useless because "Program Files" is not static, on my XP System it's called "Programme". If yo...
by jeb
07 May 2008 16:08
Forum: DOS Batch Forum
Topic: To save RTF in plain txt File Format
Replies: 2
Views: 3987

Hi,

I suppose, I understand your problem, but it is a problem.

You can either try to solve it complete with a batch file.
Reading each line and parse it - I assume it is a bad idea

or you can write a dot net program that solves it, this should be simple.

Only my suggestions :?
jeb
by jeb
06 May 2008 05:44
Forum: DOS Batch Forum
Topic: passing and gaining parameters to MS DOS Batch file
Replies: 8
Views: 8655

Hi, try this as an idea ::::::::::::::::::::::::::::::::::::::::::::::::: :loadFile <filename> <resultVar> :: Loads the content of a file into an array an set the length of the array :: without setlocal, because the array should be visible outside of this function set loadFile.counter=0 for /f "...
by jeb
04 May 2008 14:09
Forum: DOS Batch Forum
Topic: passing and gaining parameters to MS DOS Batch file
Replies: 8
Views: 8655

Hi jaffamuffin,

I tested it now with 2644 files (Windows\System32), with no problems (only echo the filenames).
I'm using Vista yet, but on XP I use a similiar batch with more than 100 files.

Your break at 30 files seems to be another problem.

jeb