VBScript & FTP

Discussion in 'Software' started by CobolExpert, Apr 15, 2005.

  1. CobolExpert

    CobolExpert Private E-2

    hmm ok another question.

    If I run this from the command prompt, it outputs the commands and respones to file.txt -
    Code:
    %windir%\system32\ftp.exe -i -n -s:Instructions.ftp > c:\file.txt
    
    If I run this from my script, it gives me the help menu or something for ftp (can't stop it fast enough to see what the error is..)
    Code:
    oWshShell.run "%windir%\system32\ftp.exe -i -n -s:" & strInstructions & " > c:\file.txt", 1, True
    
    When I echo the command its running, its exactly the same as the command I am running at the command prompt... Am I doing this wrong?

    Thanks!
    JB
     
  2. CobolExpert

    CobolExpert Private E-2

    ahh.. nevermind.

    Code:
    oWshShell.Exec "%COMSPEC% %windir%\system32\ftp.exe -i -n -s:" & strInstructions & " > c:\file.txt"
    
     
  3. CobolExpert

    CobolExpert Private E-2

    hmmm ya... so the comspec logs the interaction like this:

    Code:
    rename 2600 Old
    Old: Cannot create a file when that file already exists. 
    mkdir 2600
    2600: Cannot create a file when that file already exists. 
    
    While when I run it (without comspec of course) from the dos prompt, it logs it like this:
    Code:
    ftp> rename 2600 Old
    350 File exists, ready for destination name
    550 Old: Cannot create a file when that file already exists. 
    ftp> mkdir 2600
    550 2600: Cannot create a file when that file already exists. 
    
    In the second scenario, from the command prompt, I could search the output file for error "350" and deal with it. With the first scenario I can't do that because their are no error numbers. Each portion of the FTP code will have to be seperate... that sucks.... Anyone know a way around this?
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds