No announcement yet.

Difference in Batch file and Powerbasic?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Difference in Batch file and Powerbasic?

    If I do this in a batch file....
    dir /s/b/n *.fdb
    I get this...


    and so on; which is GREAT.
    I can sort, show paths, show anything.

    But if I do this in Powerbasic:
    DoThis$="dir /s/b/n *.fdb"
    Shell DoThis$
    I get this:


    and so on, which makes sorting confusing at times.
    Is there an easy way to preserve the long names?

    I am curious as to why when the command is executed from a batch
    file the data it gets is different from when the command is
    executed from inside a Powerbasic program? Anyone know please?

    Thank you.



    [This message has been edited by Robert E. Carneal (edited February 09, 2005).]

  • #2
    PB/DOS can only digest short file names.

    "C:\Presen~1\Demo\Demoda~1" is the SFN representation of

    Your SHELL segment is performing exactly as designed.
    Added: There are some example source code listing in the download
    section that extract LFN names from SFN. They will work only if
    you are running PB/DOS in a windows environment.

    [This message has been edited by Mel Bishop (edited February 09, 2005).]
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.


    • #3
      Robert --

      My first guess is that you are seeing a difference between COMMAND and CMD. Instead of shelling, use Start > Run to start a CMD command prompt box, and try your DIR. Then close that and use Start > Run to start a COMMAND box, and you will see the difference.

      You can use a more complex SHELL to specify which command interpreter you want to use, something along the lines of SHELL "COMMAND.COM DIR /S/B/N".

      By the way, my company's DOSBox product includes some functions that can help PB/DOS programs deal with long file names.

      [ADDED] Also by the way, different versions of Windows behave differently. For example Win9x doesn't accept the /n switch. Be sure to test your program on all of the Windows versions that you'll need to use.

      -- Eric Pearson, Perfect Sync Software

      Perfect Sync Development Tools
      Perfect Sync Web Site
      Contact Us: mailto:[email protected][email protected]</A>

      [This message has been edited by Eric Pearson (edited February 10, 2005).]
      "Not my circus, not my monkeys."