Search found 244 matches

by Endoro
24 Jan 2014 00:48
Forum: DOS Batch Forum
Topic: How to handle a comma in a filename with WMIC?
Replies: 32
Views: 31828

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

using an elevated cmd window, you can make your own short file name:

Code: Select all

fsutil file setshortname "%cd%\test.tmp" blah

This also works for folders.
by Endoro
21 Jan 2014 16:31
Forum: DOS Batch Forum
Topic: How to handle a comma in a filename with WMIC?
Replies: 32
Views: 31828

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

you may have an error: C:\Users\User\TEST>set "f=c:\\_,_.txt" C:\Users\User\TEST>for /f %a in ('WMIC DATAFILE WHERE ( name^='%f%' AND Archive^='TRUE' ^) get lastmodified ^| find "."') do @echo %a No Instance(s) Available. you may have a comma: C:\Users\User\TEST>set "f=c:\\_...
by Endoro
13 Jan 2014 18:58
Forum: DOS Batch Forum
Topic: Help with File Size Calculations
Replies: 16
Views: 15859

Re: Help with File Size Calculations

You do not need VB nor math to compare big numbers in Batch: @ECHO OFF &SETLOCAL if "%~1"=="" echo(Missing file name.&exit /b 1 if not exist "%~1" echo(File not found: "%~1".&exit /b 1 for /f %%a in ("%~1") do set "fileattrib=%%~aa&q...
by Endoro
09 Jan 2014 04:45
Forum: DOS Batch Forum
Topic: Simplify 3 lines of Code
Replies: 7
Views: 6138

Re: Simplify 3 lines of Code

..more code:

Code: Select all

for /f "tokens=1*" %a in ('fsutil fsinfo drives') do @for %c in (%b) do @vol %~dc|find "Seagate">nul&&echo %~dc
by Endoro
09 Jan 2014 02:27
Forum: DOS Batch Forum
Topic: Awk - A nifty little tool for text manipulation and more.
Replies: 30
Views: 30751

Re: Awk - A nifty little tool for text manipulation and more

.. after some research and development I come out with: If we use 'getline' with a file: result=getline line < "file" result is ⋅ -1: I/O error, Permission denied (file does not exist, file is directory) ⋅ 0: EOF, file is empty ⋅ 1: success If we use 'getline'...
by Endoro
08 Jan 2014 09:07
Forum: DOS Batch Forum
Topic: Batch to kill (Killer Batch)
Replies: 15
Views: 15236

Re: Batch to kill (Killer Batch)

You can make as many conditions as you want:

Code: Select all

wmic path Win32_PerfFormattedData_PerfProc_Process where "Name != 'idle' and not Name like '%svchost%' and PercentProcessorTime > 90" get IDProcess

Double the percent in a batch '%%svchost%%'.
by Endoro
08 Jan 2014 08:48
Forum: DOS Batch Forum
Topic: Awk - A nifty little tool for text manipulation and more.
Replies: 30
Views: 30751

Re: Awk - A nifty little tool for text manipulation and more

sorry SIR, but you need an update of your manual. 'getline' NEVER returns a negative value. And even beginners should learn, never to read from a non-existing file .... :mrgreen:
by Endoro
08 Jan 2014 07:52
Forum: DOS Batch Forum
Topic: Awk - A nifty little tool for text manipulation and more.
Replies: 30
Views: 30751

Re: Awk - A nifty little tool for text manipulation and more

nice work! short comment, please: awk "BEGIN { while ( (\"dir\" | getline line ) > 0 ) print \"reading:\",line }" instead of 'while (expression > 0)' we can simply write in awk 'while (expression)', the expression '> 0' is always 'true', and '= 0' is 'false'. awk "...
by Endoro
08 Jan 2014 06:49
Forum: DOS Batch Forum
Topic: Batch to kill (Killer Batch)
Replies: 15
Views: 15236

Re: Batch to kill (Killer Batch)

It is trying to kill "System Idle Process" here. I hope not. .. but after some research and development I come out with: @ECHO OFF &SETLOCAL for /f %%a in ('wmic path Win32_PerfFormattedData_PerfProc_Process where "Name != 'Idle' and PercentProcessorTime > 90" get IDProcess'...
by Endoro
08 Jan 2014 06:37
Forum: DOS Batch Forum
Topic: Batch to kill (Killer Batch)
Replies: 15
Views: 15236

Re: Batch to kill (Killer Batch)

i am facing some issue. About the variables. cant explain over here. Why not? Please run above code and do some research and development. Uii ... AYE SIR @ECHO OFF &SETLOCAL for /f %%a in ('wmic path Win32_PerfFormattedData_PerfProc_Process where "Name != 'Idle' and PercentProcessorTime > ...
by Endoro
07 Jan 2014 14:48
Forum: DOS Batch Forum
Topic: Batch to kill (Killer Batch)
Replies: 15
Views: 15236

Re: Batch to kill (Killer Batch)

how to get processes where the processor time is greater 90% AND the name is not "Idle" wmic path Win32_PerfFormattedData_PerfProc_Process where "Name != 'Idle' and PercentProcessorTime > 90" get Name,PercentProcessorTime,IDProcess And the command line 'for loop': for /f "to...
by Endoro
29 Nov 2013 06:11
Forum: DOS Batch Forum
Topic: Programming helpful tool suggestions
Replies: 27
Views: 18891

Re: Programming helpful tool suggestions

two more editors, for whom it may concern
Komodo, freeware
EditPlus, payware
by Endoro
29 Nov 2013 05:38
Forum: DOS Batch Forum
Topic: Rename multiple photos in just one click
Replies: 11
Views: 8376

Re: Rename multiple photos in just one click

Why do you need more than one threads: stackoverflow
by Endoro
25 Oct 2013 02:26
Forum: DOS Batch Forum
Topic: [SOLVED] copy every 3 line in new x.txt file
Replies: 8
Views: 7203

Re: copy every 3 line in new x.txt file

to preserve empty lines: @ECHO OFF &SETLOCAL (for /f "delims=" %%a in ('findstr /n "^" "file.txt"') do ( set "line=%%a" set /a cnt+=1 set /a mod=cnt%%3 SETLOCAL ENABLEDELAYEDEXPANSION set "line=!line:*:=!" if !mod! equ 0 echo(!line! endlocal ))>o...