Search found 244 matches

by Endoro
03 Jul 2016 05:52
Forum: DOS Batch Forum
Topic: Why renames/creates the simple for loop files multiple times?
Replies: 3
Views: 5506

Re: Why renames/creates the simple for loop files multiple times?

Thanks, I assume, you are right. This is probably an issue of the FAT system compatibility, namely the file entries and the for loop pointer to this entries. The for loop not always creates an additional file and sometimes it creates three or more files. It depends on whether the new file entry is a...
by Endoro
02 Jul 2016 22:56
Forum: DOS Batch Forum
Topic: Why renames/creates the simple for loop files multiple times?
Replies: 3
Views: 5506

Why renames/creates the simple for loop files multiple times?

The issue is described in this stackoverflow answer by debenham: The simple FOR command with wildcards begins iterating files before it finishes reading the entire directory. It buffers a block of files and iterates them, then picks up where it left off. When you rename a file, the renamed file may ...
by Endoro
24 May 2015 20:03
Forum: DOS Batch Forum
Topic: getting camera info from bath file?
Replies: 6
Views: 8372

Re: getting camera info from bath file?

Compo wrote:Here's all I'm willing to provide: (this isn't a powershell group)

So please do not provide Powershell code here, except in hybrid cmd shell command files.
Thank you
by Endoro
07 Oct 2014 12:13
Forum: DOS Batch Forum
Topic: For \F not working --- Revert immediately please
Replies: 7
Views: 8213

Re: For \F not working --- Revert immediately please

ShadowThief wrote:when you press SHIFT and the ' button that is next to enter.

It depends on your local keybord. It appears here when I press SHIFT and 2 :D
by Endoro
23 May 2014 19:06
Forum: DOS Batch Forum
Topic: Dir Listing based on filetype and filename iteration
Replies: 6
Views: 7731

Re: Dir Listing based on filetype and filename iteration

Give it a try: @ECHO OFF &SETLOCAL disableDelayedExpansion FOR %%a IN (test\Recording*_*.mov) DO ( FOR /f "delims=_" %%b IN ("%%~a") DO SET /a mov.%%~b+=1 ) FOR /f "tokens=1*delims==" %%a IN ('SET mov.') DO IF NOT %%b==1 ( FOR /f "tokens=1*delims=." %%c IN...
by Endoro
14 Feb 2014 06:02
Forum: DOS Batch Forum
Topic: curiosity about echo command in prompt
Replies: 2
Views: 4306

Re: curiosity about echo command in prompt

to avoid this put EOF at the end of file:

Code: Select all

C:\TEST>xxd -g1 test.cmd
0000000: 40 45 43 48 4f 20 4f 46 46 0d 0a 45 43 48 4f 20  @ECHO OFF..ECHO
0000010: 68 0d 0a 1a                                      h...

C:\TEST>test
h
C:\TEST>
by Endoro
11 Feb 2014 00:01
Forum: DOS Batch Forum
Topic: Trouble with errorlevels
Replies: 8
Views: 10521

Re: Trouble with errorlevels

untested @ECHO OFF &SETLOCAL disableDelayedExpansion rem Declare Variables SET "Java_Sec_Scope=" SET /P "Java_Sec_Scope=Would you like to set the java security level (G)lobally or for (C)urrent User? " IF /i "%Java_Sec_Scope%"=="C" GOTO Local IF /i "%...
by Endoro
10 Feb 2014 16:18
Forum: DOS Batch Forum
Topic: Trouble with errorlevels
Replies: 8
Views: 10521

Re: Trouble with errorlevels

inside a code block you need delayed expansion to access !errorlevel! (not %errorlevel%)
by Endoro
10 Feb 2014 16:07
Forum: DOS Batch Forum
Topic: Trouble with errorlevels
Replies: 8
Views: 10521

Re: Trouble with errorlevels

there is one closing parenthesis missing in your batch.
by Endoro
31 Jan 2014 10:54
Forum: DOS Batch Forum
Topic: Win7 FOR fails to parse correctly if 0Ah in parsed DSN
Replies: 3
Views: 5811

Re: Win7 FOR fails to parse correctly if 0Ah in parsed DSN

try this: for %%a in (COUNTER.txt) do fsutil file createnew COUNTER.tmp %%~za fc COUNTER.txt COUNTER.tmp /b | findstr /c:"00000016: 0A" /c:"00000017: 0A" >nul&& echo 0ah found || echo 0ah not found del COUNTER.tmp Please note, this is an example. The parameter's values ma...
by Endoro
26 Jan 2014 16:36
Forum: DOS Batch Forum
Topic: Creating carriage return (CR, 0Dh) doesn't work in Windows 8
Replies: 6
Views: 8405

Creating carriage return (CR, 0Dh) does work in Windows 8

Thank you, this is working:

Code: Select all

@echo off &setlocal disableDelayedExpansion
for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"
setlocal enableDelayedExpansion
for /l %%a in (1,1,10) do (
   <nul set /p "=%%a!CR!"
)


Problem is solved :)
by Endoro
26 Jan 2014 15:12
Forum: DOS Batch Forum
Topic: Creating carriage return (CR, 0Dh) doesn't work in Windows 8
Replies: 6
Views: 8405

Creating carriage return (CR, 0Dh) doesn't work in Windows 8

I tested the following code in XP Home x86 and Windows 8 Pro x64: @echo off &setlocal disableDelayedExpansion for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a" setlocal enableDelayedExpansion for /l %%a in (1,1,10) do ( <nul set /p "=!CR!%%a" ) Output in XP is:...
by Endoro
24 Jan 2014 12:54
Forum: DOS Batch Forum
Topic: Remove Time Element From File Creation Date
Replies: 5
Views: 6806

Re: Remove Time Element From File Creation Date

I do not know where to place the snippet that you posted. Always and only on the right place: @ECHO OFF &SETLOCAL (FOR /f "delims=" %%a IN ('dir /b /a-d /s /n "C:\Documents and Settings\All Users\Documents\My Pictures\Pics & Vids"') DO ( FOR /f "tokens=1-3*" %%...
by Endoro
24 Jan 2014 01:46
Forum: DOS Batch Forum
Topic: How to handle a comma in a filename with WMIC?
Replies: 32
Views: 37908

Re: How to handle a comma in a filename with WMIC?

Btw. %~sI and %~fsI give the same result, but M$ doesn't know it: The modifiers can be combined to get compound results: %~dpI - expands %I to a drive letter and path only %~nxI - expands %I to a file name and extension only %~fsI - expands %I to a full path name with short names only %~dp$PATH:I - ...