Search found 40 matches

by jaffamuffin
16 Dec 2011 10:12
Forum: DOS Batch Forum
Topic: DOS Batch / XP Command prompt file rename to remove spaces.
Replies: 10
Views: 13926

Re: DOS Batch / XP Command prompt file rename to remove spac

Oops for underscore to hyphen you want

replace.bat -files "-" "_" C:\files\to\rename


Or maybe the other way.. Damn looks like ive mixed the old and new up in the example ?
by jaffamuffin
16 Dec 2011 10:10
Forum: DOS Batch Forum
Topic: DOS Batch / XP Command prompt file rename to remove spaces.
Replies: 10
Views: 13926

Re: DOS Batch / XP Command prompt file rename to remove spac

My script above will do that. Paste it into a file called replace.bat. Then

replace.bat -files new old C:\tmp

i.e:

Replace.bat -files "-" " " c:\filestorename\
by jaffamuffin
12 Jan 2010 13:59
Forum: DOS Batch Forum
Topic: Processing reserved charectors in a batch
Replies: 2
Views: 2200

depending on what ou are doing, sed, grep, awk may be more suited to this. These can be called and controlled from a batch script. Also, consider storing the data in temp text files rather than in variables. As mentioned handling these sort of things is a pain in cmd, and often involves terribly ugl...
by jaffamuffin
17 Oct 2009 09:38
Forum: DOS Batch Forum
Topic: Change Variable In File
Replies: 1
Views: 2538

install vim and write a batch with the command you already use?
by jaffamuffin
16 Oct 2009 12:35
Forum: DOS Batch Forum
Topic: get ip for batch commands
Replies: 6
Views: 4323

FOR /F "tokens=2 delims=:" %%a in ('IPCONFIG ^|FIND "IP"') DO ECHO %%a
by jaffamuffin
18 Sep 2009 03:32
Forum: DOS Batch Forum
Topic: file read
Replies: 2
Views: 2854

Code: Select all

for /f %%A IN (file.txt) DO (
 IF "%%A"=="value" ECHO MATCH
)
by jaffamuffin
29 Aug 2009 12:28
Forum: DOS Batch Forum
Topic: How do I determine the number of arguments?
Replies: 7
Views: 5006

nice. As i wrote the last line in my previous reply I thought about splitting on the / .. glad to see you got a solution
by jaffamuffin
27 Aug 2009 16:43
Forum: DOS Batch Forum
Topic: Newbie here needs help to manipulate file names
Replies: 11
Views: 6858

you want a for loop and some string manipulation something like: setlocal enabledelayedexpansion set indir=X:\toberenamed\ set outdir=X:\renamed\ for /f %%A in ('dir %indir%\*.tif /b /a-d /on') DO ( set filename=%%~nA set filenumber=!filename:0,-5! set newname =!filenumber!_picture.tif c...
by jaffamuffin
27 Aug 2009 16:28
Forum: DOS Batch Forum
Topic: How do I determine the number of arguments?
Replies: 7
Views: 5006

OK I think what you need to do is parse the params for your /arg thing, and then 'sub-parse' each /arg thing found. So rough (bad) pseduo code: :main read current param and cut off last letter and store it as %number% :loop1 if %1 (less the last letter) = arg OK, parse values and read first ...
by jaffamuffin
27 Aug 2009 08:39
Forum: DOS Batch Forum
Topic: How do I determine the number of arguments?
Replies: 7
Views: 5006

m This should be helpful and fairly clear to understand. It's pretty flexible and fairly robust i think. posted here as well : @echo off SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION SET InDir=X:\tobeprocessed SET OutDir=X:\processed SET tifDir=%OutDir%\tifs SET jpgDir=%OutDir%\jpgs SET ...
by jaffamuffin
27 Aug 2009 08:33
Forum: DOS Batch Forum
Topic: Using a batch file to verify .jpg as image files
Replies: 2
Views: 3230

imagemagick using the identify command... maybe a bit ott but would do exactly as says on the tin.
by jaffamuffin
21 Aug 2009 08:08
Forum: DOS Batch Forum
Topic: Force quotes to protect DnD arguments
Replies: 2
Views: 2825

Or possibly drag and drop the folder containing the dodgy files.

Then use a For loop on dir %1 /b /a-d to get the file names.
by jaffamuffin
30 Jul 2009 05:46
Forum: DOS Batch Forum
Topic: Batch script to move files
Replies: 13
Views: 11255

this should be able to be adapted. @echo off SETLOCAL ENABLEDELAYEDEXPANSION :mainloop echo %~n1 SET folderno=%~n1 cd /d %1 SET batchcount=10001 :LOOP SET pagecount=10001 IF NOT EXIST *.tif GOTO :DONE FOR /F %%A IN ('dir /b /on /a-d') DO ( SET bcount=!batchcount:~1! SET pcount=!pagecount...
by jaffamuffin
25 Jun 2009 15:42
Forum: DOS Batch Forum
Topic: FOR not loading files with extremely long line
Replies: 3
Views: 3299

i'd probably use sed or something similar to extract patterns of text.
by jaffamuffin
25 Jun 2009 14:44
Forum: DOS Batch Forum
Topic: HELP with "FOR LOOP" inside another
Replies: 12
Views: 7272

tried fixing my old code. Couldn't quite get the text associated with the correct timestamp so here's v2. This seems to work, except for the last line. ( which i can't seem to get) @echo off SETLOCAL ENABLEDELAYEDEXPANSION :fixtimes IF EXIST tmp1.txt DEL tmp1.txt SET currentsection=1 for /F "to...