Win98banter

Win98banter (http://www.win98banter.com/index.php)
-   General (http://www.win98banter.com/forumdisplay.php?f=7)
-   -   running many files through the same command (http://www.win98banter.com/showthread.php?t=690)

Ivan Bútora June 22nd 04 03:13 PM

running many files through the same command
 
Hi everyone,

not sure if the subject of this thread is a good way to describe what I =
want to do, but here it is. Basically I wish to convert several (many) =
files from WordPerfect format to T602 format. For this, I have a small =
utility "pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I would =
do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to do =
each one individually. Is there any way to do this using a batch file? =
If I put all those files in one folder, is there any way how to generate =
a list of those files, and then run this list through the pre602.exe =
command automatically?


Question 2
I want to define a custom action for .wp files which would do the =
conversion to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of the =
filename before the file extension, and thus I had to make the output =
file something fixed, which I subsequently have to rename. I know "%1" =
refers to the file that the action is taken on. If the file is, say, =
"xxx.wp", is there any way to refer just to "xxx"?

Thanks for your input.

Ivan

Gary S. Terhune June 22nd 04 03:34 PM

running many files through the same command
 
Obviously, you wish to do a lot more than simply convert 20 or so files in
this manner, Ivan. Would be easier to simply do it one by one if that were
the case.

I'm not familiar enough with batch files to advise on their use, but I would
use Windows Scripting for this, Ivan. Ping me privately and I'll be glad to
help. It's a bit much for this group.

--
Gary S. Terhune
MS MVP for Win9x

"Ivan Bútora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe what I want
to do, but here it is. Basically I wish to convert several (many) files from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I would do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to do each
one individually. Is there any way to do this using a batch file? If I put
all those files in one folder, is there any way how to generate a list of
those files, and then run this list through the pre602.exe command
automatically?


Question 2
I want to define a custom action for .wp files which would do the conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of the
filename before the file extension, and thus I had to make the output file
something fixed, which I subsequently have to rename. I know "%1" refers to
the file that the action is taken on. If the file is, say, "xxx.wp", is
there any way to refer just to "xxx"?

Thanks for your input.

Ivan


jt3 June 22nd 04 06:06 PM

running many files through the same command
 
Ivan,
It's been a long time since I did any batch programming, and on 6.22, as
well, and 7 is no doubt somewhat different, but the first order approach
(easiest) depends upon whether or not your program pre602.exe will accept
wildcard characters, *, or ?, or not. If so, it is as easy as pre602 *.wp
*.602, conceivably. If you want a list, use the redirections symbol to
have a function such as dir put it into an output file. Remember that if
you execute a batch file within a batch file, the command processor doesn't
return to the calling batch file unless you use the CALL command to load
another copy of the command processor. Reference any dummy parameters as
%1--%9, SHIFT can be used to access more than nine dummy args. FOR loops
are available if necessary:
FOR %%x IN(1, 2, 3, 4) DO something %%x
where x is a value taken from the list (1, 2, 3, 4), etc., and is a
parameter in executing 'something' where 'something' can be almost anything
except another FOR (no FOR nesting).
IF statements are pretty standard though limited to:
IF string1==string2 command (can also be EXIST, or NOT EXIST,
etc., as in a file
referenced)
This can also test for an ERRORLEVEL (var) condition if the program gives an
ERRORLEVEL output.
Statement labels begin with a colon, and GOTO references the name without
the colon. For output, there's REM, ECHO (ON or OFF), and PAUSE, which
stops execution, displaying "Strike a key when ready.." until the key is
struck, allowing resumption of processing. I believe that there are more,
some of which came in about 6.22 and later which I never used and don't
recall, but this might be enough to do what you want?
Pardon me if I have misinterpreted your question and regaled you with
the obvious.
Joe

"Ivan Bútora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe what I want
to do, but here it is. Basically I wish to convert several (many) files from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I would do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to do each
one individually. Is there any way to do this using a batch file? If I put
all those files in one folder, is there any way how to generate a list of
those files, and then run this list through the pre602.exe command
automatically?


Question 2
I want to define a custom action for .wp files which would do the conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of the
filename before the file extension, and thus I had to make the output file
something fixed, which I subsequently have to rename. I know "%1" refers to
the file that the action is taken on. If the file is, say, "xxx.wp", is
there any way to refer just to "xxx"?

Thanks for your input.

Ivan



ppoatt June 22nd 04 06:07 PM

running many files through the same command
 
Have you tried ... Hold shift right click and
select "Open with". Select "Always use this program to
open this type of file"
Now se;ect "other" button. See if you can find T602.exe.
If you find it click on it and it will be entered in
the 'open with' list. Now highlight it in the list and OK.
This should open all the same filesyou selected to T602.
-----Original Message-----
Hi everyone,

not sure if the subject of this thread is a good way to

describe what I want to do, but here it is. Basically I
wish to convert several (many) files from WordPerfect
format to T602 format. For this, I have a small
utility "pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file

called "text.wp", I would do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I

don't want to do each one individually. Is there any way
to do this using a batch file? If I put all those files in
one folder, is there any way how to generate a list of
those files, and then run this list through the pre602.exe
command automatically?


Question 2
I want to define a custom action for .wp files which

would do the conversion to .602. I was able to do
something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to

the part of the filename before the file extension, and
thus I had to make the output file something fixed, which
I subsequently have to rename. I know "%1" refers to the
file that the action is taken on. If the file is,
say, "xxx.wp", is there any way to refer just to "xxx"?

Thanks for your input.

Ivan
.


Ivan Bútora June 22nd 04 09:13 PM

running many files through the same command
 
Thanks, Gary. I might contact you privately if I do not manage to =
accomplish what I wish with DOS/Windows commands.


"Gary S. Terhune" wrote in message =
...
Obviously, you wish to do a lot more than simply convert 20 or so =

files in
this manner, Ivan. Would be easier to simply do it one by one if that =

were
the case.
=20
I'm not familiar enough with batch files to advise on their use, but I =

would
use Windows Scripting for this, Ivan. Ping me privately and I'll be =

glad to
help. It's a bit much for this group.
=20
--=20
Gary S. Terhune
MS MVP for Win9x
=20
"Ivan B=FAtora" wrote in message
...
Hi everyone,
=20
not sure if the subject of this thread is a good way to describe what =

I want
to do, but here it is. Basically I wish to convert several (many) =

files from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:
=20
PRE602.EXE [parameters] inputfile outputfile
=20
In my case, let's say I wish to convert a file called "text.wp", I =

would do:
pre602 /d:5 text.wp text.602
=20
=20
Question 1
Imagine I have twenty files I want to convert, and I don't want to do =

each
one individually. Is there any way to do this using a batch file? If I =

put
all those files in one folder, is there any way how to generate a list =

of
those files, and then run this list through the pre602.exe command
automatically?
=20
=20
Question 2
I want to define a custom action for .wp files which would do the =

conversion
to .602. I was able to do something like this:
=20
pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of the
filename before the file extension, and thus I had to make the output =

file
something fixed, which I subsequently have to rename. I know "%1" =

refers to
the file that the action is taken on. If the file is, say, "xxx.wp", =

is
there any way to refer just to "xxx"?
=20
Thanks for your input.
=20
Ivan


Ivan Bútora June 22nd 04 09:18 PM

running many files through the same command
 
I know that I can do that, but I cannot merely open the files in T602 - =
I must convert them first with the utility that I mentioned...

"ppoatt" wrote in message =
...
Have you tried ... Hold shift right click and=20
select "Open with". Select "Always use this program to=20
open this type of file"
Now se;ect "other" button. See if you can find T602.exe.
If you find it click on it and it will be entered in=20
the 'open with' list. Now highlight it in the list and OK.=20
This should open all the same filesyou selected to T602.=20
-----Original Message-----
Hi everyone,

not sure if the subject of this thread is a good way to=20

describe what I want to do, but here it is. Basically I=20
wish to convert several (many) files from WordPerfect=20
format to T602 format. For this, I have a small=20
utility "pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file=20

called "text.wp", I would do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I=20

don't want to do each one individually. Is there any way=20
to do this using a batch file? If I put all those files in=20
one folder, is there any way how to generate a list of=20
those files, and then run this list through the pre602.exe=20
command automatically?


Question 2
I want to define a custom action for .wp files which=20

would do the conversion to .602. I was able to do=20
something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to=20

the part of the filename before the file extension, and=20
thus I had to make the output file something fixed, which=20
I subsequently have to rename. I know "%1" refers to the=20
file that the action is taken on. If the file is,=20
say, "xxx.wp", is there any way to refer just to "xxx"?

Thanks for your input.

Ivan
.


Ivan Bútora June 22nd 04 09:19 PM

running many files through the same command
 
Thanks for the e-mail. Actually, the program does accept wildcards (I =
don't know why I thought it didn't.) So indeed, that solves my first =
question - it is quite easy to do a mass conversion.
What about the second question, though? Is there any way to refer to the =
part of a file before its extension? You mentioned %1, %2, etc. How are =
%2 or %3 different from %1?


"jt3" wrote in message =
...
Ivan,
It's been a long time since I did any batch programming, and on =

6.22, as
well, and 7 is no doubt somewhat different, but the first order =

approach
(easiest) depends upon whether or not your program pre602.exe will =

accept
wildcard characters, *, or ?, or not. If so, it is as easy as pre602 =

*.wp
*.602, conceivably. If you want a list, use the redirections symbol =

to
have a function such as dir put it into an output file. Remember that =

if
you execute a batch file within a batch file, the command processor =

doesn't
return to the calling batch file unless you use the CALL command to =

load
another copy of the command processor. Reference any dummy parameters =

as
%1--%9, SHIFT can be used to access more than nine dummy args. FOR =

loops
are available if necessary:
FOR %%x IN(1, 2, 3, 4) DO something %%x
where x is a value taken from the list (1, 2, 3, 4), etc., and is a
parameter in executing 'something' where 'something' can be almost =

anything
except another FOR (no FOR nesting).
IF statements are pretty standard though limited to:
IF string1=3D=3Dstring2 command (can also be EXIST, or NOT =

EXIST,
etc., as in a =

file
referenced)
This can also test for an ERRORLEVEL (var) condition if the program =

gives an
ERRORLEVEL output.
Statement labels begin with a colon, and GOTO references the name =

without
the colon. For output, there's REM, ECHO (ON or OFF), and PAUSE, =

which
stops execution, displaying "Strike a key when ready.." until the key =

is
struck, allowing resumption of processing. I believe that there are =

more,
some of which came in about 6.22 and later which I never used and =

don't
recall, but this might be enough to do what you want?
Pardon me if I have misinterpreted your question and regaled you =

with
the obvious.
Joe
=20
"Ivan B=FAtora" wrote in message
...
Hi everyone,
=20
not sure if the subject of this thread is a good way to describe what =

I want
to do, but here it is. Basically I wish to convert several (many) =

files from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:
=20
PRE602.EXE [parameters] inputfile outputfile
=20
In my case, let's say I wish to convert a file called "text.wp", I =

would do:
pre602 /d:5 text.wp text.602
=20
=20
Question 1
Imagine I have twenty files I want to convert, and I don't want to do =

each
one individually. Is there any way to do this using a batch file? If I =

put
all those files in one folder, is there any way how to generate a list =

of
those files, and then run this list through the pre602.exe command
automatically?
=20
=20
Question 2
I want to define a custom action for .wp files which would do the =

conversion
to .602. I was able to do something like this:
=20
pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of the
filename before the file extension, and thus I had to make the output =

file
something fixed, which I subsequently have to rename. I know "%1" =

refers to
the file that the action is taken on. If the file is, say, "xxx.wp", =

is
there any way to refer just to "xxx"?
=20
Thanks for your input.
=20
Ivan
=20


jt3 June 23rd 04 04:56 AM

running many files through the same command
 
Off the top of my head, I would do that using environmental strings with
the SET command--you can define some environmental variable, say FNAME with
the SET command, and set it to the filename, sans extension, then, when you
run the batfile you have %FNAME%.wp in the reference variable and the batch
processor will replace %FNAME% with the string in the SET command, say SET
FNAME=xxx, to use your example. That way, you only need execute the SET
command to load the env. var. before you execute your .bat file.
The so-called dummy arguments referred to as %1, %2, etc., in the batch
file are simply replaced by the arguments, in numerical order, given on the
batch file command line, as for a batch file copyme.bat
COPYME first.dat second.exe third.com (space separated vars.)
would perform operations referring in the batch file to 'first.dat' as %1,
'second.exe' as %2, etc. But they're always used as parameters, not
strings.
Hope this is what you need,
Joe
"Ivan Bútora" wrote in message
...
Thanks for the e-mail. Actually, the program does accept wildcards (I don't
know why I thought it didn't.) So indeed, that solves my first question - it
is quite easy to do a mass conversion.
What about the second question, though? Is there any way to refer to the
part of a file before its extension? You mentioned %1, %2, etc. How are %2
or %3 different from %1?


"jt3" wrote in message
...
Ivan,
It's been a long time since I did any batch programming, and on 6.22,

as
well, and 7 is no doubt somewhat different, but the first order approach
(easiest) depends upon whether or not your program pre602.exe will accept
wildcard characters, *, or ?, or not. If so, it is as easy as pre602 *.wp
*.602, conceivably. If you want a list, use the redirections symbol to
have a function such as dir put it into an output file. Remember that if
you execute a batch file within a batch file, the command processor

doesn't
return to the calling batch file unless you use the CALL command to load
another copy of the command processor. Reference any dummy parameters as
%1--%9, SHIFT can be used to access more than nine dummy args. FOR loops
are available if necessary:
FOR %%x IN(1, 2, 3, 4) DO something %%x
where x is a value taken from the list (1, 2, 3, 4), etc., and is a
parameter in executing 'something' where 'something' can be almost

anything
except another FOR (no FOR nesting).
IF statements are pretty standard though limited to:
IF string1==string2 command (can also be EXIST, or NOT EXIST,
etc., as in a file
referenced)
This can also test for an ERRORLEVEL (var) condition if the program gives

an
ERRORLEVEL output.
Statement labels begin with a colon, and GOTO references the name without
the colon. For output, there's REM, ECHO (ON or OFF), and PAUSE, which
stops execution, displaying "Strike a key when ready.." until the key is
struck, allowing resumption of processing. I believe that there are more,
some of which came in about 6.22 and later which I never used and don't
recall, but this might be enough to do what you want?
Pardon me if I have misinterpreted your question and regaled you with
the obvious.
Joe

"Ivan Bútora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe what I

want
to do, but here it is. Basically I wish to convert several (many) files

from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I would

do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to do each
one individually. Is there any way to do this using a batch file? If I put
all those files in one folder, is there any way how to generate a list of
those files, and then run this list through the pre602.exe command
automatically?


Question 2
I want to define a custom action for .wp files which would do the

conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of the
filename before the file extension, and thus I had to make the output file
something fixed, which I subsequently have to rename. I know "%1" refers

to
the file that the action is taken on. If the file is, say, "xxx.wp", is
there any way to refer just to "xxx"?

Thanks for your input.

Ivan





AlmostBob June 23rd 04 09:56 AM

running many files through the same command
 
for %f in (*.*) do pre602 /d:5 %f %f.602
dos command for multiple files will convert all files in the folder nad rename
to filename.602 but will have 2 extensions, windows supports 2 extensions

--
Adaware http://www.lavasoft.de
spybot http://security.kolla.de
AVG free antivirus http://www.grisoft.com
Panda online AntiVirus scan http://www.pandasoftware.com/ActiveScan/
Catalog of removal tools http://www.pandasoftware.com/download/utilities/
Blocking Unwanted Parasites with a Hosts file
http://mvps.org/winhelp2002/hosts.htm
links provided as a courtesy, read all instructions on the pages before use
Grateful thanks to the authors/webmasters

"Ivan Bútora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe what I want
to do, but here it is. Basically I wish to convert several (many) files from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I would do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to do each one
individually. Is there any way to do this using a batch file? If I put all
those files in one folder, is there any way how to generate a list of those
files, and then run this list through the pre602.exe command automatically?


Question 2
I want to define a custom action for .wp files which would do the conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of the
filename before the file extension, and thus I had to make the output file
something fixed, which I subsequently have to rename. I know "%1" refers to
the file that the action is taken on. If the file is, say, "xxx.wp", is there
any way to refer just to "xxx"?

Thanks for your input.

Ivan



Ivan Bútora June 23rd 04 02:31 PM

running many files through the same command
 
Hi again,

thanks for the reply. First of all, I found out that the app will let me =
do a simple
pre602.exe /d:5 xxx.wp .602
and it will automatically put in the xxx, so it is not a problem =
anymore.

But let's say the app didn't let me do that. I tried what you said, and =
I was able to come up with the following procedure.
C:\ set fname.wp=3Dxxx.wp
C:\ pre602.exe /d:5 xxx.wp %fname%.602

This works well from the command line. However, if I write a .bat file =
like this (so that I can use it for the "convert" action in explorer)
set fname.wp=3D%1
pre602.exe /d:5 %1 %fname%.602

it doesn't work, since Windows puts in the full path (i.e. C:\xxx.wp) =
rather than just the file name (i.e. xxx.wp) for %1. Is there any way to =
refer to the file name without the full path?

Thanks much,

Ivan


"jt3" wrote in message =
...
Off the top of my head, I would do that using environmental =

strings with
the SET command--you can define some environmental variable, say FNAME =

with
the SET command, and set it to the filename, sans extension, then, =

when you
run the batfile you have %FNAME%.wp in the reference variable and the =

batch
processor will replace %FNAME% with the string in the SET command, say =

SET
FNAME=3Dxxx, to use your example. That way, you only need execute the =

SET
command to load the env. var. before you execute your .bat file.
The so-called dummy arguments referred to as %1, %2, etc., in the =

batch
file are simply replaced by the arguments, in numerical order, given =

on the
batch file command line, as for a batch file copyme.bat
COPYME first.dat second.exe third.com (space separated =

vars.)
would perform operations referring in the batch file to 'first.dat' as =

%1,
'second.exe' as %2, etc. But they're always used as parameters, not
strings.
Hope this is what you need,
Joe
"Ivan B=FAtora" wrote in message
...
Thanks for the e-mail. Actually, the program does accept wildcards (I =

don't
know why I thought it didn't.) So indeed, that solves my first =

question - it
is quite easy to do a mass conversion.
What about the second question, though? Is there any way to refer to =

the
part of a file before its extension? You mentioned %1, %2, etc. How =

are %2
or %3 different from %1?
=20
=20
"jt3" wrote in message
...
Ivan,
It's been a long time since I did any batch programming, and on =

6.22,
as
well, and 7 is no doubt somewhat different, but the first order =

approach
(easiest) depends upon whether or not your program pre602.exe will =

accept
wildcard characters, *, or ?, or not. If so, it is as easy as =

pre602 *.wp
*.602, conceivably. If you want a list, use the redirections symbol =

to
have a function such as dir put it into an output file. Remember =

that if
you execute a batch file within a batch file, the command processor

doesn't
return to the calling batch file unless you use the CALL command to =

load
another copy of the command processor. Reference any dummy =

parameters as
%1--%9, SHIFT can be used to access more than nine dummy args. FOR =

loops
are available if necessary:
FOR %%x IN(1, 2, 3, 4) DO something %%x
where x is a value taken from the list (1, 2, 3, 4), etc., and is a
parameter in executing 'something' where 'something' can be almost

anything
except another FOR (no FOR nesting).
IF statements are pretty standard though limited to:
IF string1=3D=3Dstring2 command (can also be EXIST, or NOT =

EXIST,
etc., as in =

a file
referenced)
This can also test for an ERRORLEVEL (var) condition if the program =

gives
an
ERRORLEVEL output.
Statement labels begin with a colon, and GOTO references the name =

without
the colon. For output, there's REM, ECHO (ON or OFF), and PAUSE, =

which
stops execution, displaying "Strike a key when ready.." until the =

key is
struck, allowing resumption of processing. I believe that there are =

more,
some of which came in about 6.22 and later which I never used and =

don't
recall, but this might be enough to do what you want?
Pardon me if I have misinterpreted your question and regaled you =

with
the obvious.
Joe

"Ivan B=FAtora" wrote in message
...
Hi everyone,

not sure if the subject of this thread is a good way to describe =

what I
want
to do, but here it is. Basically I wish to convert several (many) =

files
from
WordPerfect format to T602 format. For this, I have a small utility
"pre602.exe" which functions in this way:

PRE602.EXE [parameters] inputfile outputfile

In my case, let's say I wish to convert a file called "text.wp", I =

would
do:
pre602 /d:5 text.wp text.602


Question 1
Imagine I have twenty files I want to convert, and I don't want to =

do each
one individually. Is there any way to do this using a batch file? If =

I put
all those files in one folder, is there any way how to generate a =

list of
those files, and then run this list through the pre602.exe command
automatically?


Question 2
I want to define a custom action for .wp files which would do the

conversion
to .602. I was able to do something like this:

pre602.exe /d:5 %1 new.602
However, I am not able to figure out a way to refer to the part of =

the
filename before the file extension, and thus I had to make the =

output file
something fixed, which I subsequently have to rename. I know "%1" =

refers
to
the file that the action is taken on. If the file is, say, "xxx.wp", =

is
there any way to refer just to "xxx"?

Thanks for your input.

Ivan


=20



All times are GMT +1. The time now is 08:22 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Win98Banter.com