troubleshooting Question

Error sending Unix command from Batch file over plink (asterisk issue)

Avatar of celtician
celticianFlag for American Samoa asked on
Unix OSWindows Batch
3 Comments1 Solution1368 ViewsLast Modified:
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros