Windows DOS script

Sort:
You are not authorized to post a reply.
Author
Messages
This_Guy
Veteran Member
Posts: 93
Veteran Member
    I need to replicate my KSH scripts from our Unix machine to our new Windows and cant seem to get it to work.

    I had to gut most of the syntax but I still cant get this 'basic' importdb script to work > Tokendef, etc... any help or expertise?

    It doesnt like mypath cariable, or some of the if-then-else sytax..

    Its attached in zip format...
    Attachments
    Kwane McNeal
    Veteran Member
    Posts: 479
    Veteran Member
      If you're running Lawson on Windows, you have to use a POSIX emulation layer. You have ksh available to you either way.

      Since you don't say which UNIX platform you are coming off of, I can only give you general information, but here goes:

      IF you are using MKS, the ksh is solid standard ksh88, and does what you'd expect from more UNIX builds (particularly AIX and Solaris)

      IF you are using SUA (nee Interix), the ksh is a bit kludgey, because it is actually PDKSH. For this, I tend to use a static compiled version of ksh88 (so I don't have to mess with the cygwin silliness).
      For ksh93 on SUA, use the following: http://blog.fpmurphy.com/...o-windows-7-sua.html

      I looked at it, and it seems to be the right way to go.

      In short, you should NOT have to do much of anything to port your scripts, since they should run standard.

      Now with all of that said, if you must port them, you need to port them to PowerShell, NOT to bat/cmd scripts. The command set isn't there, and if your scripts do anything of substance, you will not be succesful at replicating them.

      The history is that command.com was designed in essence to be a cross of CPM (for compability), and simplified sh commands (for UNIX familiarity). This is because Microsoft was at that time a UNIX reseller (ala XENIX). Therefore the intent was that command.com was SUPPOSED to NOT be able to support complex commands such as {k|ba}sh, since it would have eaten into the lower end of Microsoft's other baby at that time...XENIX

      Hope this helps, and educates.

      Kwane
      954-547-7210
      John Henley
      Senior Member
      Posts: 3348
      Senior Member
        What version of Windows? Are you using LUU or MKS? If MKS, what version?

        Specifically, it looks like your script contains a hybrid of shell script syntax combined with Windows batch file syntax.  It needs to be one or the other--can't really mix them.  If you are using ksh syntax, you would use $LAWDIR not %LAWDIR%.  For batch file syntax, it's %LAWDIR%.  Fun, huh?

        As Kwane says, you should be able to run your UNIX shell scripts pretty much unaltered on your Windows box as long as you're not doing anything crazy.  That said, I have seen some issues with scripts not working with older versions of MKS (9.1/9.2) on Windows Server 2008.
        Thanks for using the LawsonGuru.com forums!
        John
        ichiben
        Advanced Member
        Posts: 21
        Advanced Member
          You should be able to use cygwin  and convert them fairly easily.  Most of them probably won't need adjusting. http://x.cygwin.com/

          cygwin
          R Wayne Walker
          New Member
          Posts: 2
          New Member

            Old thread, new problem... sorry if this is already answered somewhere else or not the way to proceed on a thread; however, I having the same or similar problem and so far Lawson/Infor has been little help.

             

            First, how can I determine the environment in LID?

            It is being hosted on Amazon AWS, Windows as specified by Infor, but beyond that I'm clueless... except for the information I've found on this and other user support sites.  How does one identify the shell?

            I do (I think) understand the concept of "lashell", but having difficulty getting the reference or user guide information I need.  I read about LUA(?) and MKS(?) but do not know how to determine which I may have ... or cygwin?  It seems like it is cygwin... but MS DOS seems to work too... (vi command.exe?).

             

            I am trying to develop batch or command line interpreter scripts, and integrate with tokendef and jobdef.

            Perl too... we use perl and need to invoke from a job and/or a script (.bat or .cmd ??? ) and I tried the "start" and "cmd" in tokendef and it only hung up... just specifying the file name seems to work.

             

            i.e. "Command   D:/mydefault/login/directory/doodahdoodah.bat" (without the quotes).

            Any help would be greatly appreciated!

             

             

            Greg Moeller
            Veteran Member
            Posts: 1498
            Veteran Member
              Try commands like set or set in LID. One or the other (possibly both) should bring back your environment variables for that session.
              Greg Moeller
              Veteran Member
              Posts: 1498
              Veteran Member
                env or set
                R Wayne Walker
                New Member
                Posts: 2
                New Member
                  Set works... "env" used to work, but doesn't now.
                  I was also able to redirect to a file, which at first I couldn't, strapped down privileges ya know... :-(
                  I do see the environment variable "SFUDIR=C:\Windows\SUA\" and others referring to "SUA", so I guess we
                  have an SUA versus MKS unix like environment? Not sure if that helps, but may... still need to develop "scripts" of some kind, to copy or move files and send emails if possible. It was doable under AIX/ksh and using perl... but this has been a real struggle. Thanks for the advice though!
                  You are not authorized to post a reply.