Computing.Net > Forums > Disk Operating System > Create batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Create batch file

Reply to Message Icon

Name: remgu
Date: May 2, 2007 at 10:14:56 Pacific
OS: XP
CPU/Ram: P4 3.4Ghz 1GB Ram
Product: Clone
Comment:

Could someone please help me create a DOS batch file that performs the following commands?

ftp.exe
ENTER
lcd c:/ftp_temp
ENTER
open 192.168.1.1
ENTER
johndoe
ENTER
pasword1
ENTER
cd audit_dumps
ENTER
get file001.prt
ENTER
bye
ENTER
exit

Thanks!
REMGU


Thanks,
REMGU



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 2, 2007 at 13:31:00 Pacific
Reply:

I suppose "lcd c:/ftp_temp" is a typo and what you really want is:

cd c:\ftp_temp

try this:

::==
@echo off

cd c:\ftp_temp

> my.ftp echo o 192.168.1.1
>> my.ftp echo johndoe
>> my.ftp echo password
>> my.ftp echo bin
>> my.ftp echo cd audit_dumps
>> my.ftp echo get file001.prt
>> my.ftp echo bye

ftp -s:my.ftp
::==



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: remgu
Date: May 3, 2007 at 05:13:20 Pacific
Reply:

Hi thanks but no I actually do use
"lcd" to have the ftp'ed file go to that location. "cd" would simply take me to that directory but not transfer the file there, right?

Thanks,
REMGU


0

Response Number 3
Name: remgu
Date: May 3, 2007 at 05:36:11 Pacific
Reply:

Thanks Mechanix2Go, "cd" works as well. It must have been a typo.

How would you go about setting it up if I want to have the batch file wait for a user input instead of executing the part below? I ask because the file name will not always be the same so if I could get the user to specify it, that would be great.

">> my.ftp echo get file001.prt"

Thanks again and sorry for the question, I did Google it and played around a while but with no success.

Thanks,
REMGU


0

Response Number 4
Name: Santa
Date: May 3, 2007 at 07:36:13 Pacific
Reply:

Would this of been beter in the Programming Forum or XP Forum ?

XP has no MS-DOS SubSystem and you are actually using CMD.exe command line.

When you originally posted ther is a warning flagged up as follows:

"DO NOT post questions related to NT Batch (DOS command prompt) scripting on this forum. Use the Programming forum.

Use the Windows NT, 2000 or XP forum for questions regarding the Windows NT, 2000 or XP "DOS" command prompt.

DO NOT ask where to download copyrighted software, including old versions of Windows or DOS, on this forum."



0

Response Number 5
Name: remgu
Date: May 3, 2007 at 07:44:14 Pacific
Reply:

Sorry. OK, I will post under Programming. Mechanix2Go, I'm giving you the credit, I hope to hear from you again!

Thanks!

Thanks,
REMGU


0

Related Posts

See More



Response Number 6
Name: Mechanix2Go
Date: May 4, 2007 at 00:34:00 Pacific
Reply:

Hi remgu,

Just ignore 'santa'; he'd rather complain than help.

To be prompted for name of file:

::== getafile.bat
@echo off

set /p filename=What file?

cd c:\ftp_temp

> my.ftp echo o 192.168.1.1
>> my.ftp echo johndoe
>> my.ftp echo password
>> my.ftp echo bin
>> my.ftp echo cd audit_dumps
>> my.ftp echo get %filename%
>> my.ftp echo bye

ftp -s:my.ftp
::==



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 7
Name: Santa
Date: May 4, 2007 at 01:39:32 Pacific
Reply:

Answered in the correct forum:

http://computing.net/programming/ww...


0

Response Number 8
Name: remgu
Date: May 4, 2007 at 06:30:26 Pacific
Reply:

Thanks Mechanix2Go!

Thanks,
REMGU


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Create batch file

Passing Parameters between multiple batch files www.computing.net/answers/dos/passing-parameters-between-multiple-batch-files/776.html

BOOK ON BATCH FILE MAKING www.computing.net/answers/dos/book-on-batch-file-making/2418.html

batch files www.computing.net/answers/dos/batch-files/1036.html