Search found 115 matches

by Yury
03 Jul 2015 23:54
Forum: DOS Batch Forum
Topic: Add number List in For Loop without enabledelayedexpansion
Replies: 15
Views: 4556

Re: Add number List in For Loop without enabledelayedexpansi

1) @echo off >"tmp.txt" ( echo three to get ready... echo four to go! ) setlocal for /f "usebackq delims=" %%a in ("tmp.txt") do ( set /a aCounter+=1 cmd /v:on /c echo !aCounter! %%a ) pause endlocal& exit /b . 2) @echo off >"tmp.txt" ( echo three to get ...
by Yury
02 Jul 2015 12:56
Forum: DOS Batch Forum
Topic: Need some code to add a suffix to the end of file names
Replies: 3
Views: 1698

Re: Need some code to add a suffix to the end of file names

...how to... get the files own date and time. I also need to check that a file hasn't already been renamed and has the correct format date and time added to the end. @echo off for %%I in (%*) do ( set n=%%~nI for /f "tokens=1-5 delims=./-: " %%J in ("%%~tI") do ( set h=0%%M ( fo...
by Yury
26 Jun 2015 11:37
Forum: DOS Batch Forum
Topic: Escape Character
Replies: 1
Views: 963

Re: Escape Character

Code: Select all

SET "STRCOMPUTER=Server003"
SET "STRLOGIN=%1"
SET "WS=ws0910 Ord_51x.bat.lnk"
by Yury
20 Apr 2015 05:22
Forum: DOS Batch Forum
Topic: Find two or more strings in an output
Replies: 2
Views: 1245

Re: Find two or more strings in an output

Code: Select all

@echo off

set "dir=C:\Test"
set filenames="1.txt" "3.txt" "5.txt"

pushd "%dir%"|| exit/b
dir %filenames%| findstr/brv /c:" " /c:$
popd

pause
by Yury
18 Apr 2015 11:14
Forum: DOS Batch Forum
Topic: Batch Animated Text
Replies: 10
Views: 8120

Re: Batch Animated Text

@for /f %%i in ('^<"%~f0" find/c /v ""') do @( for /f "delims=:" %%j in ('findstr/enc:"& :::::" "%~f0"') do @<"%~f0" ( for /f %%k in ('forfiles /m "%~nx0" /c "cmd /c echo 0x08"') do @( for /l %%l in (1 1 %%i) do @( ...
by Yury
18 Apr 2015 02:50
Forum: DOS Batch Forum
Topic: Batch Animated Text
Replies: 10
Views: 8120

Re: Batch Animated Text

Code: Select all

@powershell "gc '%~f0'|select -skip 1|%%{$_.getenumerator()|%%{write-host $_ -nonewline -foregroundcolor yellow -backgroundcolor darkgreen;sleep -milliseconds 100};''}"& pause>nul& exit/b


Hello, Flaming_PC!

Here you can place
any large text.
by Yury
11 Mar 2015 07:49
Forum: DOS Batch Forum
Topic: need a file to echo true if along.bat is running
Replies: 4
Views: 1632

Re: need a file to echo true if along.bat is running

If the along.bat doesn't produce a defined console window title add the following before it's first line @Title %~nx0 Compo, I agree. But the more reliable code will be as follows (given the possible launch from the command line and any special characters in the title): the first line in "alon...
by Yury
11 Mar 2015 03:24
Forum: DOS Batch Forum
Topic: Copy Folders & Files - How To Do This
Replies: 3
Views: 1523

Re: Copy Folders & Files - How To Do This

Code: Select all

CHDIR /d "C:\Test Data"
XCOPY "This App" "D:\This App" /E /H /I /Y
by Yury
04 Mar 2015 15:31
Forum: DOS Batch Forum
Topic: Replacing Double Quotes using BatchSubstitute
Replies: 5
Views: 1856

Re: Replacing Double Quotes using BatchSubstitute

@echo off set "in=filein.txt" set "out=fileout.txt" for /f %%i in ('^<"%in%" find/c /v ""') do<"%in%">"%out%" ( for /l %%j in (1 1 %%i) do ( set/p "x=" if defined x (cmd/v/c echo(!x:^"=!) else (echo() set "x=" ) ) ...
by Yury
11 Feb 2015 00:19
Forum: DOS Batch Forum
Topic: search string
Replies: 6
Views: 1982

Re: search string

joecepy, the correct code is

Code: Select all

@<"in.txt">"out.txt" (
for /f "tokens=2,4 delims='" %%i in ('more') do @(
 if not defined %%i_%%j (
  echo AddCubeDependency('%%i', '%%j'^);
  set %%i_%%j=*
 )
 )
)


.
by Yury
10 Feb 2015 17:11
Forum: DOS Batch Forum
Topic: search string
Replies: 6
Views: 1982

Re: search string

9764 [62f] INFO 2015-02-10 14:33:27.491 Dependency Adding cube: Cube 'DETAIL1' depends on cube ' INO _BLAH1'. I believe that the 9764 [62f] INFO 2015-02-10 14:33:27.491 Dependency Adding cube: Cube 'DETAIL1' depends on cube ' INFO _BLAH1'. would be correct. The code: @<"in.txt">"out....
by Yury
09 Jan 2015 12:34
Forum: DOS Batch Forum
Topic: Command Output handle emtpy Line in FOR Loop
Replies: 7
Views: 1958

Re: Command Output handle emtpy Line in FOR Loop

Code: Select all

for /f "skip=1" %d in ('wmic logicaldisk where VolumeName^="BACKUP150108" get caption') do @for /f %e in ("%d") do @echo backupdrive="%e"
by Yury
02 Jan 2015 16:54
Forum: DOS Batch Forum
Topic: eol=; tokens=*
Replies: 18
Views: 15800

Re: eol=; tokens=*

"Eol" must be applied to the entire string, regardless of the declared delimiters, so the problem is here: @(for /f "eol=# tokens=1-3 delims=#" %%i in ("#111#222#333#") do @echo %%i %%j %%k -- this shouldn't be!& pause>nul)|| (echo This should be!& pause>nul) @(...
by Yury
28 Dec 2014 16:01
Forum: DOS Batch Forum
Topic: Renaming folders that contain exclamation marks
Replies: 6
Views: 1785

Re: Renaming folders that contain exclamation marks

josh24 , does the first line contain only one asterisk? Try it in this case: for /d %%f in (*) do ( set /p str=<"%%f\filename.txt" for /f "tokens=1,2 delims=*" %%g in ('cmd /v:on /c "echo !str:^|=!"') do ( echo %%g%%h ren "%%f" "%%g%%h" ) ) pause .
by Yury
28 Dec 2014 12:52
Forum: DOS Batch Forum
Topic: Renaming folders that contain exclamation marks
Replies: 6
Views: 1785

Re: Renaming folders that contain exclamation marks

I think it's a problem related to enabledelayedexpansion,.. josh24 , it's true. ...but I don't know how to perform this operation without it. josh24 , try it (without "setlocal enabledelayedexpansion"): for /d %%f in (*) do ( set /p str=<"%%f\filename.txt" cmd /v:on /c "ech...