Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

windows 98 batch file reader for NT

- - - - -

  • Please log in to reply
14 replies to this topic

#1
TheRedFox

TheRedFox

    Junior

  • Member
  • Pip
  • 75 posts
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.
Posted Image
Compaq Armada 110 laptop
Pentium III 1.0ghz (finally!)
312mb ram
10gb hdd


How to remove advertisement from MSFN

#2
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 5,399 posts
  • OS:Windows 7 x64
  • Country: Country Flag
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
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#3
herbalist

herbalist

    paranoid independent

  • Member
  • PipPipPipPipPip
  • 726 posts
  • OS:98
  • Country: Country Flag
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

#4
TheRedFox

TheRedFox

    Junior

  • Member
  • Pip
  • 75 posts
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.
Posted Image
Compaq Armada 110 laptop
Pentium III 1.0ghz (finally!)
312mb ram
10gb hdd

#5
Th3_uN1Qu3

Th3_uN1Qu3

    Digital sinner

  • Member
  • PipPipPip
  • 386 posts

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.
What's the point of security features if we have to disable them for things to work right?

p35-ds3 / e6550 @ 3.5ghz 500fsb scythe mugen / 8gb pqi ddr2 800 @ 1000 / sapphire hd3870 / 320gb wd / x64 / nokia 920c 19"
toshi portege 4010 / p3 tualatin @ 933mhz / 512mb pc133 sdram / 16mb cyberblade / wifi / irda / sd / 30gb ibm / me / 12.1" tft
6bxds / 2x p3 @ 700mhz / 1gb cl2 sdram / sapphire 9800 pro 256mb / awe64 isa / sil3112a pci + 320gb wd / xp / thomson 24" tv

#6
herbalist

herbalist

    paranoid independent

  • Member
  • PipPipPipPipPip
  • 726 posts
  • OS:98
  • Country: Country Flag
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.te...es/batfiles.htm
Rick

Edited by herbalist, 24 June 2008 - 06:26 PM.


#7
MiKl

MiKl

    Member

  • Member
  • PipPip
  • 108 posts
  • OS:98SE
  • Country: Country Flag
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

#8
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,251 posts
  • OS:none specified
  • Country: Country Flag
Not really sure what the "/K" is for but that's called a "command extension" and they are not supported in Win9x OS.

Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#9
MiKl

MiKl

    Member

  • Member
  • PipPip
  • 108 posts
  • OS:98SE
  • Country: Country Flag
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

#10
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,220 posts
  • OS:none specified
  • Country: Country Flag

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.robvander...e.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

#11
MiKl

MiKl

    Member

  • Member
  • PipPip
  • 108 posts
  • OS:98SE
  • Country: Country Flag
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

#12
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,220 posts
  • OS:none specified
  • Country: Country Flag

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

#13
MiKl

MiKl

    Member

  • Member
  • PipPip
  • 108 posts
  • OS:98SE
  • Country: Country Flag
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.

#14
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,220 posts
  • OS:none specified
  • Country: Country Flag

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...864a7a9b2?pli=1
and this:
http://www.msfn.org/...-to-commandcom/

Posted Image


jaclaz

#15
jumper

jumper

    2014 All-American Masters HJ'er

  • Member
  • PipPipPip
  • 474 posts
  • OS:98SE
  • Country: Country Flag

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

Design feedback requested:
IHAtool - IpHlpApi tester; call various functions and report results
--status-> framework is solid; 22 api's fully supported; preview release coming soon
ComDlg32 wrapper - ComDlgEx meets IpHlpApi wrapper
--status-> PrintDlgExW working in latest SumatraPDF 8^)
Future projects: ImportPatcher40 - dialog interface; Kexter - IP40+Ktree+Kexstubs




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN