|
Answer» I know this might just sound very weird to do, and i seriously dont know if this is possible but could i make my batch file upload a .txt or two to a hosting website? preferably freewebs.com but also I have my lightstormlabs.com and i could use that also. What I am trying to do is make kind of a chat type of thing. It goes along with a game im working on and there would be a separate batch file for the chat, allowing you to type something and press enter, it will be sent to all the other players with their console open and also on your own. But in the game window, using the same technique, you could see who is on. so what you want to do is send file a. to the ftp server, and have file a or file b downloaded locally? the problem is to send a file to a ftp server, unless you have a guest account.. with the permission set up you will have to expose the ftp password and username to everyone using it... i've tryed similar things myself and to this day im still working on a batch encryption type thing to keep that info confidential.
but anyway, heres what you do for an ftp script
echo username>>%urfile% & echo password>>%urfile% & echo send C:\folder\myfile.cmd its ok to use a variable if you echo it into a script, but variables dont work in ftp.. next step is to start ftp ftp -s:C:\folder\script.txt account.freewebs.com ,
thats to send the file you need , if you want to download the file AFTERWARDS.. you can do that in wsh , i have the script around here somewhere just set up the URL inside and it will download (silently) into the folder of ur choice.. ill find it and post it here soonhere you go
URL = "http://www.fakeurl.co.uk.net/file.txt" set WshShell = WScript.CreateObject("WScript.Shell") Set http = CreateObject("Microsoft.XmlHttp") http.open "Get", URL, FALSE http.send "" Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("C:\j1.html", 2, 1) objFile.Write http.responseText
save it as something.vbsim scared to let out my username and passwod XD okay well im going to try it for now, but i dont FULLY understand what I replace in the code here. Could you EXPLAIN what I put where please? It seems I am unable to connect to the FTP to upload this file. infact im not even sure what file im uploading here.goto start then run and type ftp you will see this on the screen ftp> type open ftp.freewebs.com, it will ask for a user and then the password
ftp> open ftp.freewebs.com Connected to members1.freewebs.com. 220 Please report abuse or piracy to [emailprotected]! User (members1.freewebs.com:(none)):
User (members1.freewebs.com:(none)): test 331 Password required for test. Password:
you can type dir ,and help to see the commands when i try to type the password it doesnt show up. i assume its not supposed to? but then after i type it in and hit enter it says login failed.gamerx365,
Optionally you can put it all into a single batch. I.e save the following script as myUpload.bat and edit the bold strings. Quote @ftp -i -s:"%~f0"&GOTO:EOF open ftp.freewebs.com username password !:--- FTP commands below here --- lcd c:\MyLocalDirectory cd public_html/MyRemoteDirectory text hash on !:--- Upload all .txt files: mput "*.txt" !:--- Upload single .txt files: put "file1.txt" put "file2.txt" disconnect bye more info here: http://www.dostips.com/DtTipsFtpBatchScript.php#Batch_FtpBatch
DOS IT HELP?
|