Search found 22 matches

by Ben Mar
24 Jun 2015 14:37
Forum: DOS Batch Forum
Topic: self-compiled .net hybrids
Replies: 25
Views: 99523

Re: self-compiled .net hybrids

Without redundant output : You can do that trick with "cls" too //>nul 2>nul||@goto :batch /* :batch @echo off setlocal cls :: find csc.exe set "frm=%SystemRoot%\Microsoft.NET\Framework\" for /f "tokens=* delims=" %%v in ('dir /b /a:d /o:-n "%SystemRoot%\Microsoft...
by Ben Mar
20 Jun 2015 09:38
Forum: DOS Batch Forum
Topic: Help please - sort one url per line with batch file
Replies: 20
Views: 18085

Re: Help please - sort one url per line with batch file

AFAIK you can't have a goto loop within a for construct, Ben. I didn't test your code but unless you've found a way to do it, it's going to fall out of the for loop. First time to hear about it. But anyway in this code I've tested so far I didn't see any wrong result yet. When a GOTO is executed in...
by Ben Mar
20 Jun 2015 09:37
Forum: DOS Batch Forum
Topic: Help please - sort one url per line with batch file
Replies: 20
Views: 18085

Re: Help please - sort one url per line with batch file

I don't know why the output is not working properly in the original post. Here is the new fixed: @echo off setlocal EnableDelayedExpansion for /f "tokens=1,*" %%A in (long_url.txt) do ( echo %%A>url.lst if "%%B"=="" goto :eof set nextURL=%%B :Begin for /f "tokens=...
by Ben Mar
20 Jun 2015 07:30
Forum: DOS Batch Forum
Topic: Help please - sort one url per line with batch file
Replies: 20
Views: 18085

Re: Help please - sort one url per line with batch file

I did test immediately after posting and it only showed me two lines. I tried your sample case and got this, too. A 20 byte URL.LST file. cnn0.com cnn1.com OK you've right for some reason the output text is not correct and I've fixed my code to have it output correctly. I don't know why the output ...
by Ben Mar
20 Jun 2015 00:43
Forum: DOS Batch Forum
Topic: Help please - sort one url per line with batch file
Replies: 20
Views: 18085

Re: Help please - sort one url per line with batch file

Try this: @echo off setlocal EnableDelayedExpansion (for /f "tokens=1,*" %%A in (url.txt) do ( echo %%A if "%%B"=="" goto :eof set nextURL=%%B :Begin for /f "tokens=1,*" %%F in ("!nextURL!") do ( echo %%F if "%%F"=="" goto :eof s...
by Ben Mar
19 Jun 2015 23:45
Forum: DOS Batch Forum
Topic: Help please - sort one url per line with batch file
Replies: 20
Views: 18085

Re: Help please - sort one url per line with batch file

Hi Ben, Thanks for your help. This is what I need, but I only get the first two url's in "url.txt' sorted in the "url.lst'' file. All the other url's in the "url.txt' file is ignored. Any suggestions, what I should do. Thanks Philip Could you post a sample of your "url.txt"...
by Ben Mar
19 Jun 2015 12:06
Forum: DOS Batch Forum
Topic: Help please - sort one url per line with batch file
Replies: 20
Views: 18085

Re: Help please - sort one url per line with batch file

Try this: @echo off setlocal EnableDelayedExpansion (for /f "tokens=1,*" %%A in (url.txt) do ( echo %%A if "%%B"=="" goto :eof set nextURL=%%B :Begin for /f "tokens=1,*" %%F in ("!nextURL!") do ( echo %%F if "%%F"=="" goto :eof se...
by Ben Mar
13 Jun 2015 17:02
Forum: DOS Batch Forum
Topic: How to check and correct user input ?
Replies: 2
Views: 4079

Re: How to check and correct user input ?

Just change this:

Code: Select all

:KillProcess
    Taskkill /IM "%~1*" /F >> %TmpFile% 2>&1
by Ben Mar
12 Jun 2015 18:42
Forum: DOS Batch Forum
Topic: compare text files and ..
Replies: 8
Views: 7623

Re: compare text files and ..

Test this: type file2.txt|findstr /v /l /g:file1.txt Let's assume the content of file1.txt is like this: 127.0.0.1 127.0.0.3 127.0.0.5 127.0.0.7 127.0.0.9 127.0.0.11 127.0.0.13 127.0.0.15 Let's assume the content of file2.txt is like this: 127.0.0.1 127.0.0.2 127.0.0.3 127.0.0.4 127.0.0.5 127.0.0.6...
by Ben Mar
03 Jun 2015 14:14
Forum: DOS Batch Forum
Topic: Using Variable As For-Loop Token Value
Replies: 7
Views: 11398

Re: Using Variable As For-Loop Token Value

Another solution: @echo off setlocal enableextensions setlocal enabledelayedexpansion set "file=E:\temp\TEST\123458--text_text1\filename.mp4" set count=1 :forLoop for /f "tokens=%count% delims=\-" %%a in ("%file%") do ( echo !count! = %%a set /a count+=1) if !count! lss...
by Ben Mar
23 May 2015 08:40
Forum: DOS Batch Forum
Topic: Copying a file without prompting the user
Replies: 6
Views: 7064

Re: Copying a file without prompting the user

You're right foxidrive. I forgot about the possibility of space(s) in the path.
Thanks :D

Code: Select all

xcopy intro.exe "%userprofile%"  /y
by Ben Mar
23 May 2015 08:08
Forum: DOS Batch Forum
Topic: Copying a file without prompting the user
Replies: 6
Views: 7064

Re: Copying a file without prompting the user

hacxx wrote:Hi,

What is the best way to copy a file without prompting the user?

I have tried
xcopy intro.exe %userprofile%\intro.exe

but the user needs to specify if it's a folder or a file.

Thanks

How about just doing this?

Code: Select all

xcopy intro.exe %userprofile%  /y

There will be no prompt to bother at all.
by Ben Mar
18 May 2015 22:54
Forum: DOS Batch Forum
Topic: list files with full path and size
Replies: 6
Views: 12151

Re: list files with full path and size

yky wrote: "I found that the following command does what I want: forfiles /s /M *.exe /c "cmd /c echo @path @fsize" This command lists .exe files with their full path and size. From there I can filter off those whose size is not 46620. You can filter it right in one pass like this: f...
by Ben Mar
15 May 2015 12:00
Forum: DOS Batch Forum
Topic: Batch photo organizer
Replies: 15
Views: 15583

Re: Batch photo organizer

This batch file will process 50 files at a time and pause for 5 seconds then resume to do for the next 50 files, etc. You could modify it to adjust the number of files as well as the delay value in second to your liking. pushd "C:\Users\nnnnn\Desktop\Input" for /r %%f in (*.jpg) do (COPY &...
by Ben Mar
14 May 2015 15:12
Forum: DOS Batch Forum
Topic: Batch photo organizer
Replies: 15
Views: 15583

Re: Batch photo organizer

When you use "pushd" you need to call "popd" to return back to your starting point. So try this: pushd "C:\Users\nnnnn\Desktop\Input" for /r %%f in (*.jpg) do (COPY "%%f" "C:\Users\Simone\Desktop\Output") popd CLS @PAUSE @echo off for %%z in (*.jpg) ...