Jump to content

[solved] RUN command cannot find SFTP.EXE


Exit
 Share

Go to solution Solved by Gianni,

Recommended Posts

I would like to control SFTP.EXE via the RUN command.
If I solve the problem with SEND commands, I can get SFTP.EXE.
But when I work with the RUN command. SFTP.EXE is not found.
What am I doing wrong?
Here is a test script:

$host = "u76297179@home515426626.1and1-data.host"

;~ First, here's the proof that SFTP.EXE works.

Send('#xi')            ; call CMD window
Sleep(200)
Send('sftp.exe ' & $host & '{enter}')        ; call SFTP
Sleep(500)
Send('nopass{enter}')                ; enter an invalid Password
For $i = 1 To 4
    Send('{enter}')                ; enter an null Password
    Sleep(1500)
Next

;~ Now try with the RUN command
;~ Why is SFTP.EXE not found?

$rc = Run(@ComSpec & " /k sftp.exe " & $host)
ConsoleWrite("Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " RC: " & $rc & @LF)

 Output of SEND:

Microsoft Windows [Version 10.0.19044.1320]
(c) Microsoft Corporation. Alle Rechte vorbehalten.

C:\Users\xxx>sftp.exe u76297179@home515426626.1and1-data.host
u76297179@home515426626.1and1-data.host's password:
Permission denied, please try again.
u76297179@home515426626.1and1-data.host's password:
Permission denied, please try again.
u76297179@home515426626.1and1-data.host's password:
u76297179@home515426626.1and1-data.host: Permission denied (publickey,password).
Connection closed

C:\Users\xxx>

Output of RUN:

Der Befehl "sftp.exe" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

C:\Users\xxx\Documents\Data\Autoit>

Google translation:

The command "sftp.exe" is either misspelled or
could not be found.

C: \ Users \ xxx \ Documents \ Data \ Autoit>

 

Why is SFTP.EXE not found?
 

Edited by Exit
solved

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

  • Solution

try adding this lines at the beginning of your script:

#include <WinAPIFiles.au3>

;Turn off redirection for a 32-bit script on 64-bit system.
If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False)

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

@Chimpyou are the champ :thumbsup:

u76297179-sftp@home515426626.1and1-data.host's password:
Connected to home515426626.1and1-data.host.
sftp> ?
Available commands:
bye                                Quit sftp
cd path                            Change remote directory to 'path'
chgrp [-h] grp path                Change group of file 'path' to 'grp'
chmod [-h] mode path               Change permissions of file 'path' to 'mode'
chown [-h] own path                Change owner of file 'path' to 'own'
df [-hi] [path]                    Display statistics for current directory or
                                   filesystem containing 'path'
exit                               Quit sftp
get [-afpR] remote [local]         Download file
help                               Display this help text
lcd path                           Change local directory to 'path'
lls [ls-options [path]]            Display local directory listing
lmkdir path                        Create local directory
ln [-s] oldpath newpath            Link remote file (-s for symlink)
lpwd                               Print local working directory
ls [-1afhlnrSt] [path]             Display remote directory listing
lumask umask                       Set local umask to 'umask'
mkdir path                         Create remote directory
progress                           Toggle display of progress meter
put [-afpR] local [remote]         Upload file
pwd                                Display remote working directory
quit                               Quit sftp
reget [-fpR] remote [local]        Resume download file
rename oldpath newpath             Rename remote file
reput [-fpR] local [remote]        Resume upload file
rm path                            Delete remote file
rmdir path                         Remove remote directory
symlink oldpath newpath            Symlink remote file
version                            Show SFTP version
!command                           Execute 'command' in local shell
!                                  Escape to local shell
?                                  Synonym for help
sftp>

 

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

  • Exit changed the title to [solved] RUN command cannot find SFTP.EXE

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...