Search found 378 matches

by !k
15 May 2013 13:20
Forum: DOS Batch Forum
Topic: Batch file to show count of different filetypes in a folder
Replies: 17
Views: 17735

Re: Batch file to show count of different filetypes in a fol

for files without extension you get a "missing operand" error message setlocal for /f "delims=" %%f in ('dir /b/a-d *.*) do ( if "%%~xf"=="" set /a .without.extension +=1 set /a %%~xf +=1 2>nul ) set . we are not ECHOing anything, so how does the For print th...
by !k
15 May 2013 12:56
Forum: DOS Batch Forum
Topic: Batch file to show count of different filetypes in a folder
Replies: 17
Views: 17735

Re: Batch file to show count of different filetypes in a fol

DIR lists the files (you can use *.filters). Each line of its output increases the value of the variable named ".%extension%" setlocal for /f "delims=" %%f in ('dir /b/a-d *.xls *.pdf *.doc *.txt') do set /a %%~xf = %%~xf +1 set . Because file extensions are different, each file ...
by !k
15 May 2013 08:30
Forum: DOS Batch Forum
Topic: Batch file to show count of different filetypes in a folder
Replies: 17
Views: 17735

Re: Batch file to show count of different filetypes in a fol

Code: Select all

@echo off

setlocal
for /f "delims=" %%f in ('dir /b/a-d "%windir%"') do set /a files%%~xf = files%%~xf +1
set files.
pause
by !k
14 May 2013 04:23
Forum: DOS Batch Forum
Topic: Batch File to Move/Del Files of Specific Extension
Replies: 4
Views: 6616

Re: Batch File to Move/Del Files of Specific Extension

for /f "delims=" %%f in ('dir /b/s/a-d "D:\111 222 333\*.mp3"') do move "%%f" "D:\444 555 666" Processing files depending on extensions m (on Russian) http://translate.google.com/translate?sl=ru&tl=en&ie=UTF-8&u=forum.wincmd.ru%2Fviewtopic.php%3Ft...
by !k
10 May 2013 10:01
Forum: DOS Batch Forum
Topic: Batch file to Rename files to their file path
Replies: 6
Views: 6442

Re: Batch file to Rename files to their file path

Ruu wrote:OR “testb_first.txt”

Code: Select all

@echo off
setlocal enableextensions

for /f "delims=" %%a in ('dir /a-d /b /s') do call :next "%%a"
pause
goto :EOF

:next
set "name=%~1"
set "name=%name:\=_%"
echo ren "%~1" "%name:~3%
goto :EOF
by !k
16 Apr 2013 07:07
Forum: DOS Batch Forum
Topic: How to replace value in same line in DOS window.
Replies: 6
Views: 5398

Re: How to replace value in same line in DOS window.

@echo off setlocal enabledelayedexpansion (echo.N cr.txt&echo.e 100 0d 0d&echo.r cx&echo.02&echo.w 100&echo.q)|debug>NUL :: Assign a single CR to a variable, use a textfile with 2 bytes of 0x0d, 0x0d for /f "tokens=1" %%x in ('type cr.txt') do set "CR=%%x" ::...
by !k
24 Mar 2013 06:09
Forum: DOS Batch Forum
Topic: Put variable in options of for loop, for "skip=" value, but
Replies: 4
Views: 4633

Re: Put variable in options of for loop, for "skip=" value,

for /? >my.txt for /f "delims=:" %%a in ('findstr /n /c:"skip=" my.txt') do set /a n=%%a+1 rem echo n = "%n%" for /f "skip=%n% tokens=2 delims== " %%b in ('type my.txt') do ( set "var=%%b" goto :next ) :next echo var = "%var%" pause
by !k
22 Mar 2013 13:03
Forum: DOS Batch Forum
Topic: Grab variable wihin a line of text that contains constants..
Replies: 4
Views: 4713

Re: Grab variable wihin a line of text that contains constan

set "str=EntryText=Ship sunk!|Grid AO 77| Grab variable HERE, (notice the comma at the end)" setlocal enabledelayedexpansion >my.txt echo:!str! endlocal for /f "usebackq tokens=1 delims=," %%a in ( `for /f "tokens=3 delims=|" %%b in ^('findstr /c:"EntryText="...
by !k
05 Feb 2013 21:03
Forum: DOS Batch Forum
Topic: mode.com for a 98 boot disk?
Replies: 8
Views: 10370

Re: mode.com for a 98 boot disk?

taripo wrote:This mode.com from a win98 boot disk, which would be useful to me..
http://58.148.120.58/130128/01_98/WINDO ... D/MODE.COM

Is a broken link.
not broken: no hotlinking. he-he )

http://dllexedown.com/bbs/board.php?bo_ ... &wr_id=155
by !k
28 Jan 2013 07:42
Forum: DOS Batch Forum
Topic: mode.com for a 98 boot disk?
Replies: 8
Views: 10370

Re: mode.com for a 98 boot disk?

taripo wrote:incorrect dos version.
download _http://58.148.120.58/130128/01_98/WINDOWS/COMMAND/MODE.COM

or try setver.exe
by !k
03 Jan 2013 05:49
Forum: DOS Batch Forum
Topic: How to jump to the root directory from current directory
Replies: 11
Views: 10608

Re: How to jump to the root directory from current directory

"Determine parent folder name without entire folder path" viewtopic.php?f=3&t=2427
by !k
21 Aug 2012 07:23
Forum: DOS Batch Forum
Topic: Delete files which got above 7 character names in files
Replies: 10
Views: 7750

Re: Delete files which got above 7 character names in files

Code: Select all

@echo off &setlocal enableextensions

for /f "delims=" %%f in ('dir *.txt /b/a-d') do (
echo %%~nf|findstr /r /c:"^-" /c:"........" >nul &&del /q "%%f"
)