TheRedFox

windows 98 batch file reader for NT

15 posts in this topic

I'm doing an online lesson on writing batch files (it's written for 9x computers). I tried sending one to a friend who had XP, and it didn't run because the "choice" command didn't register with the XP computer. I'm wondering if there's some sort of emulator that would have the ability to run a 9x batch file on an NT computer. i understand that alot of commands and syntax are the same, but not all.

0

Share this post


Link to post
Share on other sites

Two things:

First, you could grab choice.exe from the win2k resource kit or such, or a similar 3rd party util (Win2003 and Vista do have choice.exe, and I believe Win 2008 does too).

Secondly, why learn the win98 specific stuff, instead of the newer/more recent ways? i.e. SET /P

0

Share this post


Link to post
Share on other sites

There's enough differences between 9X and NT systems that batch files written for one probably won't work on the other. I use a lot of batch files on my 98 boxes. None of them worked properly on a Win2K box without a lot of changes.

Besides the differences in syntax and in the commands themselves, you also have the problem of long file names, which are common on NT systems but have to be truncated for batch files in DOS. The truncated names used by DOS will cause problems in batch files run on NT systems. All the paths are likely to be completely different as well. On NT systems, the batch files run in windows, which limits what can be done with them compared to those running in pure DOS.

I haven't seen an emulator that does what you're asking. Even if one does exist and can handle the differences in the commands, file name length, and the syntax, it wouldn't be able to account for the differences in the paths used in the batch file. You'd still have to edit those manually. It would be easier in the long run just to write separate batch files for each.

Rick

0

Share this post


Link to post
Share on other sites

I appreciate all of your input. The reason why I'm learning then 9x syntax is because the tutorial I found happens to use that. also I generally use my Windows 98SE laptop rather than an XP computer.

0

Share this post


Link to post
Share on other sites
I appreciate all of your input. The reason why I'm learning then 9x syntax is because the tutorial I found happens to use that. also I generally use my Windows 98SE laptop rather than an XP computer.

I'm actually glad they're different. I'm doing a XP patch for an older game and i use command line scripts a lot. On 98/Me the batch simply does not run, sparing me of the trouble to implement a version checker. :thumbup

You can run a virtual 98 machine inside your XP and learn on that.

0

Share this post


Link to post
Share on other sites

One of the better sites I've seen for DOS and Windows command line is at Computer Hope. They have separate pages for each command and show the differences in the syntax each one needs for both DOS and Windows NT systems.

Some more DOS sites:

http://www.ahuka.com/dos/index.html

http://dos.rsvs.net/

http://home7.inet.tele.dk/batfiles/batfiles.htm

Rick

Edited by herbalist
0

Share this post


Link to post
Share on other sites

Hi Guys,

sorry for bringing up this old thread but I thought that is not necessary to create a new one just for my small problem which may be solved in a few seconds by people with the knowledge !!

I have two batch files which I need to run every two months or so but they work only on XP and I just would like to know why they are not working on an 98SE machine ?

1)

@echo off

for /k %%b in (3000000,1,3030799) do if exist %%b.jpg copy 0001o.jpg %%b.jpg

2)

@echo off

for /k %%b in (3030800,1,3030999) do copy 0001o.jpg %%b.jpg

Any ideas ? Best regards, Mikl

0

Share this post


Link to post
Share on other sites

Not really sure what the "/K" is for but that's called a "command extension" and they are not supported in Win9x OS.

0

Share this post


Link to post
Share on other sites

Aah, thanks !! Can anybody lead me in the right direction how a Win98se compliant batch would look like ?

It is not live saving issue but I would love to do that work without having to go to XP ... :angel

0

Share this post


Link to post
Share on other sites

Aah, thanks !! Can anybody lead me in the right direction how a Win98se compliant batch would look like ?

It is not live saving issue but I would love to do that work without having to go to XP ... :angel

The issue right now is that the FOR /K is NOT a documented batch command in XP either.

The syntax seems like it is a FOR /L loop:

http://www.robvanderwoude.com/ntfor.php

What those one-liners (a batch script tends to be a little more complex) - provided that a /L switch is used - seem aimed to perform is an apparently senseless task, i.e. going through a number of files named n.jpg (respectively with n from 3000000 to 3030799 and from 3030800 to 3030999) and replace all find occurences of the file with a copy of the same source image 0001o.jpg (and of course just one of the two spanning from 3000000 to 3030999 would do instead).

Maybe if you explain the actual goal it would be easier to provide you with some suggestions. :unsure:

jaclaz

0

Share this post


Link to post
Share on other sites

Thanks Jaclaz,

I just overlooked to correct the /K /L-thing back to the original XP-script because I was testing various (parameter-) versions in the hope that one would work on 98SE.

Do you maybe know how a loop have to look like for 98SE ?

MiKl

0

Share this post


Link to post
Share on other sites

Do you maybe know how a loop have to look like for 98SE ?

Maybe if you explain the actual goal it would be easier to provide you with some suggestions. :unsure:

Let's see how long we can loop like this. :ph34r::whistle:

jaclaz

0

Share this post


Link to post
Share on other sites

I already mentioned that I use these batches on XP without problems and with the results that I need.

If anybody else could just give me a rough guide how a loop would like I could start from there. Thank you.

0

Share this post


Link to post
Share on other sites

I already mentioned that I use these batches on XP without problems and with the results that I need.

But you didn't state the actual result you want (and BTW the one liners you posted with the /K swtch have NO way to be actually working, and once the /K is replaced with /L they become sintactically coorect but still make little sense), I had to guess and I am not even 100% sure to have guessed right.

If anybody else could just give me a rough guide how a loop would like I could start from there. Thank you.

Good :), you made it a perfect S.E.P. for me (exiting the loop nicely).

You are consequently kindly invited to ignore this:

http://groups.google.com/group/alt.msdos.batch/browse_thread/thread/382cde7864a7a9b2?pli=1

and this:

Forrestreversedisappear_version1.gif

jaclaz

0

Share this post


Link to post
Share on other sites

I have two batch files which I need to run every two months or so but they work only on XP and I just would like to know why they are not working on an 98SE machine ?

1)

@echo off

for /k %%b in (3000000,1,3030799) do if exist %%b.jpg copy 0001o.jpg %%b.jpg

Try this (the "if exist" is incorporated into the file set):


@echo off
for %%b in (300????.jpg) do copy 0001o.jpg %%b
for %%b in (301????.jpg) do copy 0001o.jpg %%b
for %%b in (302????.jpg) do copy 0001o.jpg %%b
for %%b in (30300??.jpg) do copy 0001o.jpg %%b
for %%b in (30301??.jpg) do copy 0001o.jpg %%b
for %%b in (30302??.jpg) do copy 0001o.jpg %%b
for %%b in (30303??.jpg) do copy 0001o.jpg %%b
for %%b in (30304??.jpg) do copy 0001o.jpg %%b
for %%b in (30305??.jpg) do copy 0001o.jpg %%b
for %%b in (30306??.jpg) do copy 0001o.jpg %%b
for %%b in (30307??.jpg) do copy 0001o.jpg %%b

2)

@echo off

for /k %%b in (3030800,1,3030999) do copy 0001o.jpg %%b.jpg

If we note that the copy is unconditional, and presume that because of previous action, the files already exist, then we can reuse the previous plan of attack:


@echo off
for %%b in (30308??.jpg) do copy 0001o.jpg %%b
for %%b in (30309??.jpg) do copy 0001o.jpg %%b

Combining the two:


@echo off
for %%b in (300????.jpg) do copy 0001o.jpg %%b
for %%b in (301????.jpg) do copy 0001o.jpg %%b
for %%b in (302????.jpg) do copy 0001o.jpg %%b
for %%b in (3030???.jpg) do copy 0001o.jpg %%b

If we cannot presume that any files have previously been created, this second batch file can be done recursively:


@echo off
if %1*==* for %%a in (8,9) do call %0 3030%%a
if not %1*==* if %2*==* for %%b in (0,1,2,3,4,5,6,7,8,9) do call %0 %1 %1%%b
if not %2*==* for %%c in (0,1,2,3,4,5,6,7,8,9) do copy 0001o.jpg %2%%c.jpg

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.