celtician
asked on
Error sending Unix command from Batch file over plink (asterisk issue)
Im having trouble sendin the next command over plink from a batch file, its an asterisk issue.
I can execute it directly with putty or winscp command mode obtaining the result i need, however since i need to handle the output filename i need to call it from a batch file and im getting an error.
This is the command i have on the batch file (it returns the file name i need) that should write the filename in a given txt file (filename_here.txt)
plink -P 22 -l username -pw password machine.extension "ls -alrt C*.TXT | tail -1 | awk '{print $NF}'" >>Â filename_here.txt 2>&1
The output should be
C1234.TXT
however this is whats written in my txt file:
C*.TXT: No such file or directory
I can execute it directly with putty or winscp command mode obtaining the result i need, however since i need to handle the output filename i need to call it from a batch file and im getting an error.
This is the command i have on the batch file (it returns the file name i need) that should write the filename in a given txt file (filename_here.txt)
plink -P 22 -l username -pw password machine.extension "ls -alrt C*.TXT | tail -1 | awk '{print $NF}'" >>Â filename_here.txt 2>&1
The output should be
C1234.TXT
however this is whats written in my txt file:
C*.TXT: No such file or directory
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
plink does not enter the directory in question because it's not the "home" directory of "username".
Thx for the points!
Thx for the points!
ASKER
I tried your suggestion and now its working, it wasn't looking in the directry i wanted.
Strange, do you know why is not entering directly that directory? just as a follow up, since your answer is correct :)
thank you!