Error Using Shell Command to Create Directory

I am working on a way for our firm to track various engagements. I want to be able to specify a default drive and directory structure to store engagements in a Setup record (which I have done). I then want to create a new folder in that default path each time a new record is added to the table. I have all the code written to do this, but now that I am putting it into production, I am having a length problem with the SHELL command. I have a 75 character max description for the engagement and the default path takes 50 characters max. When I try to issue the SHELL(‘cmd /c’, ‘md’, FolderPath) command in Navision, it is now giving me an error “the length of the source exceeds the size of the destination buffer”. The help file says the SHELL command can take strings of up to 128 characters, but the most I can pass is 77. This is on Navision 3.70 if that matters. Any help would be greatly appreciated since everyone is expecting this to work tomorrow. David Hibler

I had troubles using parameters with SHELL so I include all parameters into the Name string (see help file). After that I concluded that the maximum string length is about 250, but that should do for your task. If you use the search in this forum you will find that the standard solution to SHELL problems is using Windows Scripting Host and automation. You might want to look into that.

Hello, instead of using the SHELL command you could use the automation server ‘Windows Script Host Object Model’.Folders to add a directory.

Oh yes, one more: Windows Scripting Host is kernel functionality on Windows XP and 2003, and needs to be installed for all previous Windows versions (if not done already).

I had looked at the Windows Scripting Automation solutions and didn’t want to have to install that on 75+ computers in the office if I could help it. I actually figured out an alternate solution last night. The payroll system creates a ddxmit01.bat file to copy the direct deposit export file to the transmit folder. I just took a page out of Navision’s book and did the same thing. I put my mkdir and the full path name into a batch file, ran the batch file using the SHELL command, and erased the file when I was finished. It’s a crude solution compared to using Windows Scripting Automation, but it was easier to implement since I wouldn’t have to install anything on the other computers in the office. David