Search found 244 matches

by Endoro
16 Jun 2013 16:32
Forum: DOS Batch Forum
Topic: new findstr bug
Replies: 20
Views: 11983

Re: new findstr bug

on XP:

Code: Select all

><nul set /p "=#" | findstr /n "^"

><nul set /p =# | findstr /n "^"
1:#
by Endoro
13 Jun 2013 08:04
Forum: DOS Batch Forum
Topic: how can I store a paragraph in a variable
Replies: 7
Views: 2715

Re: how can I store a paragraph in a variable

Thank you @foxidrive and here the code: @echo off &setlocal enabledelayedexpansion set "myparagraph=I like the colour blue""I like pets""My favourite pet is a boxer dog" set LF=^ REM ^two empty lines are important^ set "myparagraph=%myparagraph:""=!LF...
by Endoro
12 Jun 2013 15:33
Forum: DOS Batch Forum
Topic: how can I store a paragraph in a variable
Replies: 7
Views: 2715

Re: how can I store a paragraph in a variable

try this: @echo off &setlocal enabledelayedexpansion set "myparagraph="I like the colour blue""I like pets""My favourite pet is a boxer dog"" set LF=^ REM ^two empty lines are important^ set "myparagraph=%myparagraph:""="!LF!"%&quo...
by Endoro
04 Jun 2013 08:14
Forum: DOS Batch Forum
Topic: Batch - Split directory name on folder parts?
Replies: 4
Views: 1984

Re: Batch - Split directory name on folder parts?

my try: @echo off&setlocal set "var=C:\folder1\folder2\folder3\folder4\" REM do not touch the empty lines set LF=^ REM do not touch the empty lines setlocal enabledelayedexpansion set "var=%var:\=!LF!%" for %%i in (%var%) do ( set /a counter+=1 set "var!counter!=%%i"...
by Endoro
03 Jun 2013 02:24
Forum: DOS Batch Forum
Topic: syntax to replace a search string containing =
Replies: 6
Views: 2222

Re: syntax to replace a search string containing =

@echo off setlocal EnableDelayedExpansion set "String=Hi how is the day=100 for you" REM My requirement is to replace day=100 with day=222 in the above string. set old=day=100 set new=day=222 for /F "tokens=1,2 delims==" %%a in ("%String%") do ( rem Char next to %%a in...
by Endoro
31 May 2013 06:30
Forum: DOS Batch Forum
Topic: Batch to delete directory with path-too-long problem.
Replies: 14
Views: 8465

Re: Batch to delete directory with path-too-long problem.

yes, of course. you can have a fully functioning test version to remove the annoying path.
by Endoro
31 May 2013 01:05
Forum: DOS Batch Forum
Topic: Batch to delete directory with path-too-long problem.
Replies: 14
Views: 8465

Re: Batch to delete directory with path-too-long problem.

I used a batch script to create some folders in XP: @echo off :loop set /a counter +=1 echo %counter% md "%counter%" || goto:eof cd "%counter%" || goto:eof goto:loop it stopped at #85 with the message "file name or extension too long". I removed it without problems &quo...
by Endoro
29 May 2013 23:43
Forum: DOS Batch Forum
Topic: Rename text file based on content
Replies: 31
Views: 13507

Re: Rename text file based on content

select the desired line with the "skip" parameter: for /f "usebackq skip=2 delims=" for the ⋅ first line remove the skip parameter ("skip=0" doesn't work) ⋅ 2nd line: skip=1 ⋅ 3rd line: skip=2 ⋅ and so on My code doesnt count empt...
by Endoro
29 May 2013 20:56
Forum: DOS Batch Forum
Topic: Rename text file based on content
Replies: 31
Views: 13507

Re: Rename text file based on content

simply add the extension to the new name: @echo off&setlocal cd Renamed_Files for /f "delims=" %%i in ('dir /a-d/b *.txt') do ( set "nname=" set "fname=%%~i" for /f "usebackqskip=2delims=" %%f in ("%%~i") do if not defined nname set "nname=%...
by Endoro
29 May 2013 16:11
Forum: DOS Batch Forum
Topic: File Search and copy
Replies: 2
Views: 1447

Re: File Search and copy

I don't know exactly what you mean. In a set of files

Code: Select all

1305120315641.mp4
1305120315642.mp4
1305130315641.mp4
1305130315642.mp4

this works:

Code: Select all

C:\TEST>dir /b 130512*1.mp4
1305120315641.mp4
by Endoro
29 May 2013 12:39
Forum: DOS Batch Forum
Topic: Rename text file based on content
Replies: 31
Views: 13507

Re: Rename text file based on content

try this. Look at the output and remove the word "echo" before "rename" if it is OK: @echo off&setlocal cd Renamed_Files for /f "delims=" %%i in ('dir /a-d/b *.txt') do ( set "nname=" set "fname=%%~i" for /f "usebackqskip=2delims=" %%f ...
by Endoro
27 May 2013 11:25
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 13025

Re: create folders from a list and move files

Yes, you are right. But now one single dot is not enough, we need subgroups (ClassID): @echo off&setlocal set "startfolder=%~1" &rem parameter #1 set "targetfolder=%~2" &rem parameter #2 set "ClassID_ID_List=%~3" &rem parameter #3 set "CSVfile=%~4&q...
by Endoro
27 May 2013 07:29
Forum: DOS Batch Forum
Topic: How-to hide error output from Reg Query command?
Replies: 7
Views: 8168

Re: How-to hide error output from Reg Query command?

yes, output must to "find", not to "nul" ... :oops:
by Endoro
27 May 2013 06:11
Forum: DOS Batch Forum
Topic: How-to hide error output from Reg Query command?
Replies: 7
Views: 8168

Re: How-to hide error output from Reg Query command?

ok, try this:

Code: Select all

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Code Store Database\Distribution Units" /f "Java Runtime Environment" /s >nul 2>&1 | find "HKEY_LOCAL_MACHINE" > del.txt