SHELL function and ftp.exe

Tintin25Tintin25 Member Posts: 14
Hello

Facing a problem with a SHELL function in a report. The following code gives me a failure that a sign is not allowed: (Which sign is not defined)

ShellRetCode := SHELL('ftp.exe -s:' + Command_File);

where

Command_File := C:\DOCUME~1\sge\LOKALE~1\Temp\sendftp.txt

The txt-file sendfrp.txt include:

Open [ftp site]
username
password
cd upload/
put C:\DOCUME~1\sge\LOKALE~1\Temp\/1234.xml
quit

If I fired the following line off in cmd

'ftp.exe -s:C:\DOCUME~1\sge\LOKALE~1\Temp\sendftp.txt'

there are no problem and it uploads my xml file.

What am I missing??

Answers

  • mihail_kolevmihail_kolev Member Posts: 379
    This one may be useful: viewtopic.php?f=32&t=31440
    What am I missing??
    I guess double quotes ("").

    make it '"ftp.exe -s:C:\DOCUME~1\sge\LOKALE~1\Temp\sendftp.txt"'
    -Mihail- [MCTS]
  • Tintin25Tintin25 Member Posts: 14
    This one may be useful: viewtopic.php?f=32&t=31440
    What am I missing??
    I guess double quotes ("").

    make it '"ftp.exe -s:C:\DOCUME~1\sge\LOKALE~1\Temp\sendftp.txt"'

    I already tried that...stil saying that a sign is not allowed...
  • DenSterDenSter Member Posts: 8,304
    Have you tried the full path? So "Documents And Settings" instead of "Docume~1"?
  • Tintin25Tintin25 Member Posts: 14
    DenSter wrote:
    Have you tried the full path? So "Documents And Settings" instead of "Docume~1"?

    Yeah, the thing is the path must not have any spaces and according to the documentation to fill the space you have to use something like this %~f0, and I think the problem is the sign "~".

    But on the other hand I also tried just place the sendftp.txt and xml file in a local directory like c:\temp so the function call is SHELL('ftp.exe -s:C\Temp\sendftp.txt') - just hardcoded it. Again if I execute it from Nav it will give a error but if I execute from cmd: ftp.exe -s:C\Temp\sendftp.txt no problem.
  • matttraxmatttrax Member Posts: 2,309
    I assume ftp.exe can be called from any path? You haven't changed to that directory in the command prompt and then run it, right?
  • Tintin25Tintin25 Member Posts: 14
    matttrax wrote:
    I assume ftp.exe can be called from any path? You haven't changed to that directory in the command prompt and then run it, right?

    Yep thats correct but I not sure if I follow you regarding changing directory. Can you give me an example?

    We have just upgraded from a Navision 3.60 to a Nav 2009 version and I not sure SHELL function have changed...
  • ara3nara3n Member Posts: 9,256
    shell function has changed in 2k9.

    You need to hit F1 and you'll the documentation.

    Basically parameters need to be passed separately

    SEHLL('FTP.EXE',pARAM1, pARAMETER2);
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Tintin25Tintin25 Member Posts: 14
    Hello all

    Thanks for all the help and you all lead me in the right direction.

    The solution to my problem is:

    ShellRetCode := SHELL('c:\windows\system32\ftp.exe', '-s:' + Command_File);

    As noticed you have to specify the hole directory where ftp.exe is located and as ara3n pointed out the SHELL function have changed since (i'm just a junior consultant :D ).
  • DenSterDenSter Member Posts: 8,304
    Tintin25 wrote:
    i'm just a junior consultant :D
    Don't sell yourself short, you got the job done didn't you. Besides, senior consultants learn new things every day, so get used to being in "figuring out mode" :mrgreen:

    Thanks for the follow up, that's what makes this a very valuable post :thumbsup:
Sign In or Register to comment.