ITSky8 Posted February 20, 2008 Share Posted February 20, 2008 Hello! I would like to run some DOS commands in AutoIT, but I tried both Run an _RunDos, they are doesn't work, why? What I want is to send a file to my FTP server, the DOS commands and Batch is listed on below, please help to check the script listed on below, thanks! Run("c:\temp\2FTP.bat") open ftpserver username password cd folder-in-ftp-server prompt off mput c:\temp\*.jpg bye _RunDOS("ftp") _RunDOS("open ftpserver") _RunDOS("username") _RunDOS("password") _RunDOS("cd folder-in-ftp-server") _RunDOS("prompt off") _RunDOS("mput c:\temp\*.jpg") _RunDOS("bye") Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 20, 2008 Share Posted February 20, 2008 (edited) Hello! I would like to run some DOS commands in AutoIT, but I tried both Run an _RunDos, they are doesn't work, why? What I want is to send a file to my FTP server, the DOS commands and Batch is listed on below, please help to check the script listed on below, thanks! Run("c:\temp\2FTP.bat") open ftpserver username password cd folder-in-ftp-server prompt off mput c:\temp\*.jpg bye _RunDOS("ftp") _RunDOS("open ftpserver") _RunDOS("username") _RunDOS("password") _RunDOS("cd folder-in-ftp-server") _RunDOS("prompt off") _RunDOS("mput c:\temp\*.jpg") _RunDOS("bye") The commandline FTP console has its own shell environment. To pass your script to FTP.exe, do this: Run(@ComSpec & ' /c ftp /s "c:\temp\2FTP.bat"', @TempDir) That runs the ftp command, with a "/s" switch that tells it to execute the script file inside the ftp shell. The _RunDOS() for each command is even sillier because the shell environment is created and destroyed for each one. Like opening a command line, typing one command, closing the command console, then opening a new one for each command. P.S. Note single quotes enclosing double quotes. Edited February 20, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ITSky8 Posted February 21, 2008 Author Share Posted February 21, 2008 It's doesn't work, with the Run(@ComSpec & '/c ftp /s"d:\temp\startftp.bat"', @TempDir), any other solutions? Thanks!Hello!I would like to run some DOS commands in AutoIT, but I tried both Run an _RunDos, they are doesn't work, why? What I want is to send a file to my FTP server, the DOS commands and Batch is listed on below, please help to check the script listed on below, thanks!Run("c:\temp\2FTP.bat")open ftpserverusernamepasswordcd folder-in-ftp-serverprompt offmput c:\temp\*.jpgbye_RunDOS("ftp")_RunDOS("open ftpserver")_RunDOS("username")_RunDOS("password")_RunDOS("cd folder-in-ftp-server")_RunDOS("prompt off")_RunDOS("mput c:\temp\*.jpg")_RunDOS("bye") Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 21, 2008 Share Posted February 21, 2008 It's doesn't work, with the Run(@ComSpec & '/c ftp /s"d:\temp\startftp.bat"', @TempDir), any other solutions? Thanks! Well, you could have tweaked it a little... I coded that line from memory, if you bring up the help (FTP -h) then you see the script parameter is "-s:<path>", so all it takes to fix it is: RunWait(@ComSpec & ' /c ftp.exe -s:"C:\Temp\Test\Test2.ftp"', @TempDir) ...which I tested with this for Test2.ftp: open ftp.microsoft.com anonymous nobody@nowhere.com pwd ls close quit Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ITSky8 Posted February 21, 2008 Author Share Posted February 21, 2008 Thanks for your help! It's working now, but how to hide the DOS Shell? Well, you could have tweaked it a little... I coded that line from memory, if you bring up the help (FTP -h) then you see the script parameter is "-s:<path>", so all it takes to fix it is: RunWait(@ComSpec & ' /c ftp.exe -s:"C:\Temp\Test\Test2.ftp"', @TempDir) ...which I tested with this for Test2.ftp: open ftp.microsoft.com anonymous nobody@nowhere.com pwd ls close quit Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 21, 2008 Share Posted February 21, 2008 (edited) Thanks for your help! It's working now, but how to hide the DOS Shell?Like this?? RunWait(@ComSpec & ' /c ftp.exe -s:"C:\Temp\Test\Test2.ftp"', @TempDir, @SW_HIDE) Edited February 21, 2008 by TzarAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now