Jump to content

AutoIT exe works manually but while invoking with JAVA, it just launches cmd and nothing happens after that


Recommended Posts

Hi There ! 

I have a script here

 

;Launch CMD
Run("C:\Windows\System32\cmd.exe")
sleep(2000)
$cmdHandle = WinActivate("C:\Windows\System32\cmd.exe")
Sleep(2000)

;Sending document
ControlSend($cmdHandle, "", "", "ftp" & @CRLF)
ControlSend($cmdHandle, "", "", "open" & @CRLF)
Sleep(2000)
ControlSend($cmdHandle, "", "", "first command" & @CRLF)
Sleep(2000)
ControlSend($cmdHandle, "", "", "second-coomand" & @CRLF)

 

first-command and second-command I can't provide cause it's internal. I have complied this .au3 file into an exe and it does the work. But I need to invoke this with Java. Java code I have tried is

 

    ProcessBuilder pb = new ProcessBuilder("C:\\Users\\username\\eclipse-workspace\\Examples\\src\\com\\own\\examples\\etc.exe");
    pb.start();
    Thread.sleep(5000);

 

Through java it just launches the cmd and nothing happens after that. Please help !!

Link to comment
Share on other sites

What about #requireadmin?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

You could use ftp batch text file instead which would be more reliable method:

Example (untested):

#include <File.au3>
Local $sFTPTemp = _TempFile(@TempDir)
FileWrite($sFTPTemp, "Open 127.0.0.1" & @CRLF)
FileWrite($sFTPTemp, "Command1" & @CRLF)
FileWrite($sFTPTemp, "Command2" & @CRLF & "Quit" & @CRLF)
;~ Use @ComSpec & ' /c ...' to [C]lose the command prompt window
;~ Use @ComSpec & ' /k ...' to [K]eep the command prompt window open
RunWait(@ComSpec & ' /k ftp -n -s:"' & $sFTPTemp & '"')
FileDelete($sFTPTemp)

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...