Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: pball
I made a script that will process numbered files in a folder. I am aware of this "problem" i'm gonna explain.
When it runs it uses a for loop to process each file separately. So it starts with file 1 then 10,11,12,13,etc then moves on to 2,20,21
Is there a way to override this so it counts 1,2,3,4,etc
It isn't vital to what I'm doing but it would be nice to have them done in order.
here is my script
for /f "tokens=*" %%x in ('dir /b *.vob') do (
echo %%x
"F:\Encoding\Programs\megui\tools\dgindex\DGIndex.exe" -AIF=[%%~nx.vob] -IA=7 -TN=80,81 -OM=1 -OF=[%%~nx] -hide -exit
)FYI it extracts audio from vob files and makes an avs script and dv2 project file. I'm batch encoding a dvd here.

That could work for future use.
another mostly unrelated question I have also is there a way to remove quotes and file extensions from a full file name?
I have a set /p var=
then i drag a file onto the batch window and the location and name of the file are entered. The problem is if there are spaces in the location/name there are quotes when it's entered, if there are no spaces there are no quotes.how can i remove the quotes if present and file extension?
so "F:\hey you\text.txt" would be F:\hey you\text
and F:\hey\text2.txt would be F:\hey\text2

The below has a couple of limitations. Firstly if a file is not supposed to have a extension but a dot 4 or 5 characters in (depending on if it had quotes or not) it will be trimmed off. Var has to be defined to clear the second line as I couldn't get it to take quotes on the outside.
if not defined var goto :eof
if [^%var:~0,1%]==[^"] set var=%var:~1,-1%
if "%var:~-4,1%"=="." set var=%var:~0,-4%

Thanks Judago
That works perfectly and I don't see any problem with it. My files have nice name and 3 digit ext names.
Guess that's the end of this thread. I love quickly resolved threads, even though one is just playing the system

'dir /b *.vob'
Not obvious how that would give ANY ordering. But I'll stay tuned.
=====================================
If at first you don't succeed, you're about average.M2

"'dir /b *.vob'
Not obvious how that would give ANY ordering. But I'll stay tuned."
The dir command always seems sort it's output 0-9/a-z by default unless another sort order is specified (/o), the fact that *.vob is specified means that it will only output files that end in .vob in a sorted order.
This is just my experience though, I don't know if it's the same everywhere.

well i looked up that /o thing for the dir command. Lets you sort by name, ext, date, etc but when you choose alphabetical order it still uses that screwy 1,10,11,12 type of counting.

"The dir command always seems sort it's output 0-9/a-z by default unless another sort order is specified"
Not in my experience.
A sample
dir/b *.txt
rose-bud.txt
5191766.txt
bladeless.txt
amazon.txt
klint.txt
roseb.txt
PEG-prof.txt
24HRgold.TXT
=====================================
If at first you don't succeed, you're about average.M2

Mechanix2Go,
Come to think of if your probably right, what I *should* have said is this is my experience with windows xp.Would you belive I was trying to be cautious about making a broad and uninformed statment? I really nailed that one........

Hey I have a completely unrelated question to hijack my thread with.
Is there a way to make a long line in a batch script break to a new line?
For example:
"F:\Encoding\Programs\megui\tools\x264\x264.exe" --pass 1 --bitrate 700 --stats ".stats" --keyint 240 --min-keyint 24that is about half of that line, is there a way to split it between lines (like wordwrap) and still have it all run? I don't want to have to scroll way over to see to whole line.
also wouldn't be a way to make a warning or something pop up when you try to close a batch program while it's running, don't wanna be able to accidentally close out of a script that takes a while to run

I'm not entirely sure how to do either of these things, as such.
You could hide your window with nircmd, cmdow or something similar, then no one could close your window accidentally.
I did read something here about using hex 0a for something along the lines you asking but didn't get it to work(Only spent a couple of minutes on it).

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |