Search found 1878 matches

by Aacini
26 Jun 2012 10:29
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

You may also use this approach, that is simpler to write: rem Outer loop: for %%D in (for-set) do ( some commands... rem Inner loop: SET BREAK= for %%A in (for-set) do IF NOT DEFINED BREAK ( commands of inner loop... IF SOME_CONDITION SET BREAK=TRUE ) <- original closing parentheses of inner FOR mor...
by Aacini
26 Jun 2012 10:18
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

I don't understand your code, why you write it this way. if !ThisIsLegalNumber! EQU 1 %and% not defined break What does it mean? I think that it doesn't solve anything. Will this break the loop or not? Next code there. OK. Let's be more clear about this matter. If you have a FOR loop nested inside ...
by Aacini
26 Jun 2012 00:13
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

It is just a clearer way to write an IF with two conditions. If you don't like it, you may write:

Code: Select all

    if !ThisIsLegalNumber! EQU 1 if not defined break (
instead.

Perhaps if you show us your complete code (starting at the outer loop) I can write the exact modification you need...
by Aacini
25 Jun 2012 23:49
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

set and=if . . . . . set break= rem The inner loop start here... if !ThisIsLegalNumber! EQU 1 %and% not defined break ( REM ECHO THIS IS LEGAL NUMBER SET legalNumber=!second! SET /A cnt=!cnt!+1 if !cnt! LSS 4 ( SET IP=!IP!!legalNumber!. ) else ( SET IP=!IP!!legalNumber! SET /A cnt=0 SET /A Search_I...
by Aacini
25 Jun 2012 21:47
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

You may get an equivalent behaviour of breaking the inner loop and passing to the next iteration of the outer loop if you enclose the body of inner loop in an IF controled by a break variable: @echo off for %%D in (1 2 3) do ( set break= for %%A in (1 2 3) do ( if not defined break ( echo D=%%D, A=%...
by Aacini
24 Jun 2012 22:54
Forum: DOS Batch Forum
Topic: USB DRIVER HELP!!! (SOLVED)
Replies: 13
Views: 8735

Re: USB DRIVER HELP!!!

A simple modification allows to omit A:\ and B:\ floppy drives: @echo off set USB_DRIVE=none for /F "tokens=1*" %%a in ('fsutil fsinfo drives') do ( for %%c in (%%b) do ( if %%c gtr C:\ ( for /F "tokens=3" %%d in ('fsutil fsinfo drivetype %%c') do ( if %%d equ Removable ( set USB...
by Aacini
24 Jun 2012 17:59
Forum: DOS Batch Forum
Topic: USB DRIVER HELP!!! (SOLVED)
Replies: 13
Views: 8735

Re: USB DRIVER HELP!!!

Excuse me. I have not reviewed your program, I just focused on your question. Perhaps is this what you want? @echo off set USB_DRIVE=none for /F "tokens=1*" %%a in ('fsutil fsinfo drives') do ( for %%c in (%%b) do ( for /F "tokens=3" %%d in ('fsutil fsinfo drivetype %%c') do ( if...
by Aacini
24 Jun 2012 17:46
Forum: DOS Batch Forum
Topic: Advanced Batch features via auxiliary .exe programs
Replies: 76
Views: 200924

Re: Advanced Batch features via auxiliary .exe programs

I added optional parameters to Window GSize command that allows to minimize, maximize and restore a window; also, there are two additional parameters that allows to Hide and Show a window. An interesting feature of these new parameters is that a hidden window can not be manually cancelled! For furth...
by Aacini
21 Jun 2012 18:17
Forum: DOS Batch Forum
Topic: Advanced Batch features via auxiliary .exe programs
Replies: 76
Views: 200924

Re: Advanced Batch features via auxiliary .exe programs

Abra cadabra I like the getkey Thanks a lot, Ed! Really need to learn the x86 instruction set somedayZzz... Yes, it is the way to do some "magic" (not by sleight of hand) I made a couple minor corrections to above programs; if you copied some of the programs below, you should complete the...
by Aacini
20 Jun 2012 21:14
Forum: DOS Batch Forum
Topic: Advanced Batch features via auxiliary .exe programs
Replies: 76
Views: 200924

Re: Advanced Batch features via auxiliary .exe programs

The following Batch subroutine separate in two 16-bits numbers the 32-bits ERRORLEVEL value returned by some auxiliary programs: :GetCoords Cols= Lines= set /A "%1=%errorlevel%&0xFFFF, %2=(%errorlevel%>>16)&0xFFFF" exit /B EDIT : I added optional parameters to Window GSize command....
by Aacini
20 Jun 2012 00:45
Forum: DOS Batch Forum
Topic: Copy File:If Empty Or Not Exists - NOTIFY- If Exists - COPY
Replies: 13
Views: 10163

Re: Copy File:If Empty Or Not Exists - NOTIFY- If Exists - C

This becomes worse at each step! Please, try to follow this description/pseudo-code: - FOR each i File(*).DAT in source folder: - IF File(i) is empty or doesn't exist THEN Do nothing - ELSE Delete any *.dat files in destination folder. Copy the source *.dat files to destination folder Rev(*).dat - E...
by Aacini
19 Jun 2012 23:44
Forum: DOS Batch Forum
Topic: Copy File:If Empty Or Not Exists - NOTIFY- If Exists - COPY
Replies: 13
Views: 10163

Re: Copy File:If Empty Or Not Exists - NOTIFY- If Exists - C

This is even funnier than before.

You said:
- In source folder A
IF File(1).DAT is empty or doesn't exist THEN
Do nothing
ELSE
???????
ENDIF

If do nothing if the file doesn't exist or is empty, and do nothing if the file exist, then the whole IF don't cares at all!
by Aacini
19 Jun 2012 23:19
Forum: DOS Batch Forum
Topic: Copy File:If Empty Or Not Exists - NOTIFY- If Exists - COPY
Replies: 13
Views: 10163

Re: Copy File:If Empty Or Not Exists - NOTIFY- If Exists - C

There is a basic point you had not mentioned yet: How do you know that a file not exists? At first I thought that the file name must be the same in both source and destination folders, but you said that the file must be renamed when copied. So, what you are talking about? I further suppose that the ...
by Aacini
19 Jun 2012 21:49
Forum: DOS Batch Forum
Topic: Run .AWK File To Format Data In All Files In A Location
Replies: 6
Views: 4514

Re: Run .AWK File To Format Data In All Files In A Location

Batch file below solve this topic: @echo off for %%a in ("File(*).DAT") do ( for /F "tokens=1,2 delims=(" %%b in ("%%a") do ( awk -f Format.awk %%a > %%bAwked(%%c ) ) Batch file below process just not empty files: @echo off for %%a in ("File(*).DAT") do ( if %...
by Aacini
15 Jun 2012 20:44
Forum: DOS Batch Forum
Topic: Advanced Batch features via auxiliary .exe programs
Replies: 76
Views: 200924

Advanced Batch features via auxiliary .exe programs

Batch file capabilities can be improved via external .exe files, in the same way provided by the standard DOS-Windows external commands (findstr.exe, sort.exe, etc). I developed a series of auxiliary commands that provide some additional features to Batch programs, so we can use these commands to as...