What is the length limit for operating system commands that can be executed using the functions DOS, UNIX, SYSTEM or the bang (!) operator?

9 views (last 30 days)
I want to know what is maximum length allowable for commands that are passed to the operating system when executing the functions DOS, UNIX, SYSTEM or the bang (!) operator.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 May 2021
Edited: MathWorks Support Team on 19 May 2021
The maximum number of characters that you can use to run an external application and pass arguments to it depends on your exact operating system.
The limits for some of the Windows versions are listed below:
- 128 characters:
Microsoft Windows NT Advanced Server 3.1
Microsoft Windows NT Workstation 3.1
- 2046 characters:
Windows NT 4.0
Windows 2000
- 8191 characters:
Windows XP
If you use another Windows version, Linux, Mac or another supported operating system, then consult the documentation that is included with it or try to find the information on the internet using a search engine.
Related information can be found here:
Command prompt (Cmd.exe) command-line string limitation
If the command you want to execute exceeds the limit of your Windows system and if the cause are long file or folder paths, you may use the DOS functions "subst" or "net use" as a possible workaround.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!