Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. Pass arguments to ftp -s command

Pass arguments to ftp -s command

Scheduled Pinned Locked Moved Windows API
comsysadminquestion
4 Posts 3 Posters 50 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mc_Topaz
    wrote on last edited by
    #1

    I have a file which I run with the ftp using the -s switch in the Windows terminal. The file instruct the FTP-module to get a file from the FTP-server. I would like to specify the file as a parameter. Is this possible? For instance the instructions.txt "instructs" the FTP-command what to do:

    open ftp-server.com
    name
    password
    get file.txt

    Then I run everything with this command:

    ftp -s:instructions.txt

    Can I pass the file name as a parameter instead of hard coding the file name in the instructions.txt? Best regards /Steffe

    L J 2 Replies Last reply
    0
    • M Mc_Topaz

      I have a file which I run with the ftp using the -s switch in the Windows terminal. The file instruct the FTP-module to get a file from the FTP-server. I would like to specify the file as a parameter. Is this possible? For instance the instructions.txt "instructs" the FTP-command what to do:

      open ftp-server.com
      name
      password
      get file.txt

      Then I run everything with this command:

      ftp -s:instructions.txt

      Can I pass the file name as a parameter instead of hard coding the file name in the instructions.txt? Best regards /Steffe

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Depends which ftp you are using. What does the documentation say?

      1 Reply Last reply
      0
      • M Mc_Topaz

        I have a file which I run with the ftp using the -s switch in the Windows terminal. The file instruct the FTP-module to get a file from the FTP-server. I would like to specify the file as a parameter. Is this possible? For instance the instructions.txt "instructs" the FTP-command what to do:

        open ftp-server.com
        name
        password
        get file.txt

        Then I run everything with this command:

        ftp -s:instructions.txt

        Can I pass the file name as a parameter instead of hard coding the file name in the instructions.txt? Best regards /Steffe

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #3

        According to

        ftp -h

        it is not posssible. But you can write a small batch / command file that does it for you:

        @echo off
        rem send-ftp.cmd: Upload file via FTP
        if %1.==. goto err
        echo open ftp-server.com > instructions.txt
        echo name >> instructions.txt
        echo password >> instructions.txt
        echo get %1 >> instructions.txt
        ftp -s:instructions.txt
        goto end
        :err
        echo Missing file name parameter
        :end

        M 1 Reply Last reply
        0
        • J Jochen Arndt

          According to

          ftp -h

          it is not posssible. But you can write a small batch / command file that does it for you:

          @echo off
          rem send-ftp.cmd: Upload file via FTP
          if %1.==. goto err
          echo open ftp-server.com > instructions.txt
          echo name >> instructions.txt
          echo password >> instructions.txt
          echo get %1 >> instructions.txt
          ftp -s:instructions.txt
          goto end
          :err
          echo Missing file name parameter
          :end

          M Offline
          M Offline
          Mc_Topaz
          wrote on last edited by
          #4

          Thank you!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups