Search found 1878 matches
- 07 Jul 2012 09:50
- Forum: DOS Batch Forum
- Topic: Progress bar While copying
- Replies: 12
- Views: 26836
Re: Progress bar While copying
@echo off setlocal EnableDelayedExpansion :: Get USB Drive Letter SET "ID_1=C07325E8" FOR /F %%! IN ('WMIC LOGICALDISK LIST FULL ^|FINDstr /c:%ID_1%') DO SET drv=%%! set "target=%drv%\home\docs\BU\%date:/=%" IF NOT EXIST "%target%" MD "%target%" >nul MD "...
- 06 Jul 2012 18:40
- Forum: DOS Batch Forum
- Topic: Progress bar While copying
- Replies: 12
- Views: 26836
Re: Progress bar While copying
@echo off setlocal EnableDelayedExpansion set WildCard=*.* if "%1" neq "" set WildCard=%1\*.* set Total=0 for %%a in (%WildCard%) do set /A Total+=1 if %Total% leq 60 ( set /A Unit=1, UnitSize=60/Total ) else ( set /A Unit=Total/60+1, UnitSize=1 ) set UnitBar= for /L %%a in (1,1...
- 06 Jul 2012 17:36
- Forum: DOS Batch Forum
- Topic: summary from multiple text files in folder
- Replies: 4
- Views: 3096
Re: summary from multiple text files in folder
Code: Select all
@echo off
( for %%a in (*.txt) do (
for /F "tokens=2" %%b in ('findstr "Total" "%%a"') do echo %%a %%b
) ) > summary.tmp
ren summary.tmp summary.txt
- 06 Jul 2012 17:23
- Forum: DOS Batch Forum
- Topic: Move unmatched files
- Replies: 1
- Views: 2034
Re: Move unmatched files
Code: Select all
@echo off
cd DirA
for %%a in (*.*) do (
if not exist "\DirB\%%a" (
copy "%%a" \DirC
)
)
- 05 Jul 2012 13:12
- Forum: DOS Batch Forum
- Topic: Trying to build a Uptime.exe alternative via native windows
- Replies: 31
- Views: 33491
Re: Trying to build a Uptime.exe alternative via native wind
You may also use my StdTime and StdDate programs for Time-to-milliseconds/Date-to-JDN and opposite conversions.
BTW, what represent the other data shown by wmic?
Antonio
BTW, what represent the other data shown by wmic?
Code: Select all
>wmic OS Get LastBootUpTime
LastBootUpTime
20120705113410.500000-300
YYYYMMDDHHMMSS.??????????
Antonio
- 04 Jul 2012 00:46
- Forum: DOS Batch Forum
- Topic: Advanced Batch features via auxiliary .exe programs
- Replies: 76
- Views: 214407
Re: Advanced Batch features via auxiliary .exe programs
7- StdTime.exe.hex : 4D5A900003[3]04[3]FFFF[2]B8[7]40[35]B0[3]0E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F74 2062652072756E20696E20444F53206D6F64652E0D0D0A24[7]55917B8611F015D511F015D511F015D59FEF06D51BF015D5ED D007D513F015D55269636811F015D5[8]5045[2]4C01030087A8EF4F[8]E0000F010B...
- 03 Jul 2012 16:24
- Forum: DOS Batch Forum
- Topic: Fast way to test if a value is between several ranges
- Replies: 8
- Views: 9768
Re: Fast way to test if a value is between several ranges
Tnxs, you both
Could we be more descriptive, perhaps
Could we be more descriptive, perhaps
- 03 Jul 2012 13:08
- Forum: DOS Batch Forum
- Topic: Fast way to test if a value is between several ranges
- Replies: 8
- Views: 9768
Fast way to test if a value is between several ranges
The usual way to check if a given variable contain anyone of several possible values is by trying to delete the variable from the list of values; if the result is the same, the variable is not in the list: set values=10,25,45,90,120,180 if "!values:%variable%=!" neq "!values!" ec...
- 01 Jul 2012 21:32
- Forum: DOS Batch Forum
- Topic: The ultimate While loop
- Replies: 2
- Views: 41328
The ultimate While loop
The purpose of this topic is to define a While loop that can be used in the easiest way. A step by step explanation of this problem follows, but if you just want to write a While loop, you may skip this description and pass to In Conclusion section below. The idea is to write and execute a repetitiv...
- 30 Jun 2012 05:31
- Forum: DOS Batch Forum
- Topic: I want to make StartProcess
- Replies: 2
- Views: 5071
Re: I want to make StartProcess
I see several problems trying to do that. Your starter must duplicate the Window size/appareance/font/etc. of START command in multiple details, otherwise posterior cmd.exe commands may fail or not display their results correctly. I think that just duplicate the functionality of START command may be...
- 29 Jun 2012 19:56
- Forum: DOS Batch Forum
- Topic: create an empty .txt file if the file doesnt exist
- Replies: 9
- Views: 21705
Re: create an empty .txt file if the file doesnt exist
Funny thing! REM command followed by space and any comment does NOT create the empty file: rem > notworks.txt rem any comment > notworks.txt However, REM followed by certain special separator characters DO create the empty file! rem. > thisworks.txt rem/any comment > thisworks.txt rem:anything > thi...
- 29 Jun 2012 18:24
- Forum: DOS Batch Forum
- Topic: create an empty .txt file if the file doesnt exist
- Replies: 9
- Views: 21705
Re: create an empty .txt file if the file doesnt exist
In the old MS-DOS days, REM command could be used to create an empty file this way:but that "functionality" was removed in Windows.
You may use any command that may show a text, but that show nothing. I used CD .:
Code: Select all
rem > empty.txt
You may use any command that may show a text, but that show nothing. I used CD .:
Code: Select all
cd . > empty.txt
- 26 Jun 2012 19:12
- Forum: DOS Batch Forum
- Topic: Clipping filespec path
- Replies: 7
- Views: 4242
Re: Clipping filespec path
This is the way I would do it:
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set "target=xyz"
for /D /R %%a in (%target%*) do (
for /D %%b in ("%%a\*") do (
set "filename=%%~Fb"
echo !filename:*%target%=\%target%!
)
)
- 26 Jun 2012 16:07
- Forum: DOS Batch Forum
- Topic: Is it possible to break loop?
- Replies: 31
- Views: 57400
Re: Is it possible to break loop?
You have not to add one extra level of brackets, just an IF in the same line of the inner FOR: 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 in...
- 26 Jun 2012 11:37
- Forum: DOS Batch Forum
- Topic: Is it possible to break loop?
- Replies: 31
- Views: 57400
Re: Is it possible to break loop?
What hasn't been explained is that the variable from the outer loop is available within the inner loop Dave Benham This point is "explained" in the FOR help this way: Remember, FOR variables are single-letter, case sensitive, global, and you can't have more than 52 total active at any one...