Results 1 to 6 of 6

Thread: OS_Shell characters limit

  1. #1
    Junior Member
    Join Date
    Dec 2023
    Posts
    16
    Rep Power
    3

    OS_Shell characters limit

    Is the OS_Shell() function limited to using a command string of 255 characters or less? I am trying to send it a longer length command and it gets truncated at 255.

    I am writing to a batch file as a workaround. But was wondering if there was a way around the limitation?

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,828
    Rep Power
    10
    Ciao,

    I do not limit input command string.
    There must be a sub limitation somewhere in the calling chain.

    What version of thinBasic and what operating system are you using?

    Have you tried also Shell command from thinBasic Core engine to see if it makes any difference?
    https://help.thinbasic.com/index.html?shell.htm

    Eros
    Last edited by ErosOlmi; 17-02-2025 at 23:33.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    Junior Member
    Join Date
    Dec 2023
    Posts
    16
    Rep Power
    3
    thinBasic_1.13.0.0.zip

    running on:
    Edition Windows 11 Pro
    Version 23H2
    Installed on ‎6/‎5/‎2024
    OS build 22631.4460
    Experience Windows Feature Experience Pack 1000.22700.1047.0


    OK I put together a quick testing program, trying on two similar system, and got the same result. Basically, the OS_Shell function limits the length of the command to 255 characters, but the Shell core version does not. Am I doing something wrong here? Thank you Eros!


    Uses "Console", "File", "OS"
    dim temp$ as string

    temp$ = REPEAT$(250, "1")
    temp$ &= REPEAT$(250, "2")

    PrintL "OS_Shell..."
    OS_Shell("cmd.exe /c echo " & temp$, ,%OS_SHELL_SYNC)

    Printl
    PrintL "Shell core engine..."
    Shell("cmd.exe", "/c echo " & temp$)

    waitkey(60)
    Stop

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,828
    Rep Power
    10
    mmmm strange results here

    Thanks for the example.

    I've to test on different systems and try understand why here it's giving different results when the internal command is the same.
    Limit should be around 32K for command line

    Will let you know.
    Attached Images Attached Images
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,828
    Rep Power
    10
    Please find attached a new thinBasic_OS.dll module
    Please unzip in the same folder of your script so thinBasic Core Engine will load local local version of the module instead of the one in \thinBasic\Lib\

    I've completely recoded OS_Shell function using the same WIN32 API used in Core Shell function: CreateProcessA

    Let me know

    Ciao
    Eros
    Attached Files Attached Files
    Last edited by ErosOlmi; 20-02-2025 at 06:52.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    Junior Member
    Join Date
    Dec 2023
    Posts
    16
    Rep Power
    3
    Thank you so much. I finished the script I was working on, and it is working great with the new .dll

    The reason that my command line string is so long is because it is for the FFmpeg.exe audio processor. The arguments plus the pathnames end up at a ridiculous length, like 350 chrs.

Similar Threads

  1. OS_Shell - question/issue
    By ReneMiner in forum OS
    Replies: 12
    Last Post: 16-09-2015, 22:44
  2. Replies: 2
    Last Post: 20-11-2014, 15:40
  3. The limit as t --> 0, of, sin(t)/t
    By danbaron in forum Math: all about
    Replies: 1
    Last Post: 28-07-2011, 01:05
  4. The Limit of Randomize()
    By danbaron in forum General purpose scripts
    Replies: 0
    Last Post: 18-02-2010, 09:34
  5. Textbox Limit?
    By catventure in forum thinBasic General
    Replies: 8
    Last Post: 18-11-2006, 19:15

Members who have read this thread: 6

Posting Permissions

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