Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DOS Batch Programming

    Hello,

    I have a batch file called version.bat. It has one line.

    version=17

    I want some batch code that will recognize this string in the batch file, and run another batch process if that number increases. I also need it to record the new value when the batch process is run, so that if it changes again, it will run again. Our IS person has stated it's not possible. Any ideas?

    Thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: DOS Batch Programming

    I don't think DOS was too good with file internals, and someone has run off with my DOS books...

    The "modern" Microsoft-promoted way to do this would be to use the Windows Script Host, which allows you to use VBScript in all its glory - subject to the security context. Will that work for your application?

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DOS Batch Programming

    What is that batch file supposed to do? That one line is not a valid batch file command unless you have an executable program named Version.exe on your path and it takes a parameter 17. Otherwise, running that batch file should produce an error message "Invalid command or file name."

    If it is supposed to create an environment variable and assign it a value of 17, then the line should read:

    <pre>SET version=17
    </pre>


    If version is an environment variable, then you can use the following batch code to see if it is not equal to 17:

    <pre>If NOT "version" == "17" GOTO NOT17
    ECHO version is 17
    GOTO DONE
    :NOT17
    ECHO version is NOT 17
    ONE
    </pre>


    Finding out if it increased would be very difficult, depending on the range of how it could increase. DOS batch files basically only have an equal compare. How you would do it would also depend on what versions of DOS it had to run on.
    Legare Coleman

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DOS Batch Programming

    Yes, it is SET version=17.

    However, when I attempt to run this code, I get the following error: Out of environment space... any ideas?
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DOS Batch Programming

    What version of Windows/DOS are you trying to run it on, and where is it being run (Autoexec.bat, DOS Window, Boot to DOS, etc)?
    Legare Coleman

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DOS Batch Programming

    Windows 98 (hence the forum) <img src=/S/grin.gif border=0 alt=grin width=15 height=15> The Command is being run in a dos window after windows initializes, at which time i'm getting an "out of environment space" error.
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  7. #7
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DOS Batch Programming

    Look in the root directory of the Win 98 boot drive for a file named CONFIG.SYS. If that file exists edit it, if it does not exist use an editor to create it. Put a statement in the file that looks like this:

    <pre>SHELL=C:COMMAND.COM /E:2048 /P
    </pre>


    The number after the /E: specifies the environment size, and 512 is the default. Change the C: to be the path to where COMMAND.COM lives on your system. You will have to reboot for this change to take affect.
    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •