command line 128 char limit

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

command line 128 char limit

Post by Bob Hansen » Fri Feb 24, 2006 12:53 am

Macro Scheduler 7.4.009 running on WIN98SE, and executing XXcopy Pro.

XXcopy routine is not running from Macro Scheduler on WIN98SE.

When Macro Scheduler runs, the command window flashes too quickly for me to see results. But I think I caught it once and found only 128 characters being accepted on the command line.

My script is running the following line ( total characters is about 197, all on one line):

Run Program>xxcopy.exe \\PGM2\C\*\* D:\Backups\PGM2\ /CR8 /BU /PB /FF /CK0 /WV0 /OAC:\Data\Backups\Logs\20060223Msg.log /FoC:\Data\Backups\Logs\20060223Files.log /FMSDTZAL /ExC:\Data\Backups\Xxcopy\PGM2_ExcludeList.txt

If I open a command window and paste the line above, WIN98 only shows the first 128 chars.
If I open a command window and paste the line above, Xxcopy runs fine on XP-PRO.
If I run Macro Scheduler script on WINXP-PRO, Xxcopy runs fine.

The actual line in the program has 6 predefined %variables% passed in like this:
Run Program>xxcopy %Source% %Destination% %Switches% %MessageLog% %FilesLog% /FMSDTZAL %Exclude%

I know the script is processing the full string becauseI can see the results in the log, and it works OK on WINXP system. I copy/paste from the log into the Command window to test running manually.

Even if I could map a letter to "C:\Data\Backups\", I would still be over the 128 limit. (Mapping is not a preference for logging reasons, need to see absolute real paths).

So, the question is how do I overcome the limit of only 128 characters being accepted on the command line?

Note that spacing on this forum may look incorrect, but the real code is OK.
Last edited by Bob Hansen on Fri Feb 24, 2006 8:23 am, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Feb 24, 2006 2:23 am

Is it possible to write these variables to a text file and have the other program (XXCOPY) read the file? I have done this before when passing what seemed like too many variables to another macro. I'm not familiar with XXCOPY...

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Feb 24, 2006 5:38 am

Its been a while since I've had to deal with Win95 and never had a copy of Win98 but It seems like 128 characters was the command line limit. Quick search in Google Groups and there are apparently config.sys settings that can extend the character length limit but I would think that would apply only to DOS windows.

Have you tried running as a DOS process from MS?

Run Program>command /c xxcopy.exe \\PGM2\C\*\* D:\Backups\PGM2\ /CR8 /BU /PB /FF /CK0 /WV0 /OAC:\Data\Backups\Logs\20060223Msg.log /FoC:\Data\Backups\Logs\20060223Files.log /FMSDTZAL /ExC:\Data\Backups\Xxcopy\PGM2_ExcludeList.txt

Another alternative would be to write a batch file, run the batch file then delete the batch file.

Also read that the command line length limit in XP is 8190.

Hope this is helpful,
Dick

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Feb 24, 2006 8:21 am

Thanks for suggestions, SkunkWorks and Dick.

Current status:
1. Must be run on WIN98SE, so stuck with 128 limit.
2. Running with command.com does not work. I had already tried that.
3. Batch file is a possibility, but would have to make code to create dynamically, since this is run in a loop many times, each time with changing variables.
4. Xxcopy does allow a text file to be used with switch /CF:Filename.xcf, similar to a batch file, one line per parameter. But like batch file, would have to create dynamic versions, would like to avoid that work.
5. It looks like XXcopy does have an undocumented switch /ze0 that calls an environment variable that accepts most switches except Source and Destination, so I think I will try this:

Code: Select all

SetEnvVar>xxcopy,%Switches% %MessageLog% %FilesLog% /FMSDTZAL %Exclude% 
Run Program>xxcopy %Source% %Destination% /ze0
//Clear environment variable xxcopy
SetEnvVar>xxcopy,
May not be able to test this for a few days.

But, even if the /ze0 switch works for this particular script, is it possible for Macro Scheduler to format command lines longer than 128 characters for the WIN9x class of systems? Still have many of them out there to support.

Could this be considered for future enhancement?
I think I found info on Microsoft pages that indicated the last bits of the "command" command could be altered to allow a larger length?

Again, thanks for listening and for the suggestions and help.
Last edited by Bob Hansen on Fri Feb 24, 2006 8:25 am, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Feb 24, 2006 8:22 am

Command-Line Filenames Appear Limited to 127 Characters
http://support.microsoft.com/kb/121059/en-us
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Feb 24, 2006 8:34 am

Thanks Marcus... sounds like the best solution.

From the referenced link:
RESOLUTION
The global command-line character limitation can be increased to its maximum by placing the following line in the CONFIG.SYS file:

shell=c:\windows\command.com /u:250 /p


This command affects all MS-DOS virtual machines (VMs) as well as the Windows 95 command line.

NOTE: If the SHELL command is already present with the /u switch, increase the value to 250.
I did some digging first but this link escaped my searches. This will be the easiest solution, and requires no changes to Macro Scheduler either.

Thanks again Marcus, I can even implement this one over the phone in three minutes or less.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Feb 24, 2006 8:46 pm

Problem Solved! :D

Thank you Marcus.
I added the single line to config.sys and the string passed from Macro Scheduler to the command window was accepted, all ran well.

I will be sending this solution over to the forum for XXcopy also.
Will probably add to all existing WIN9X systems at next maintenance calls.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts