Kaseya Community

Echo a less than symbol

This question has suggested answer(s)

Using the agent procedures, I am trying to echo a < less than symbol that is failing. Below is my procedure. I am calling on psftp.exe to transfer some files. I need it to use an answer file but the command is < answerfile.txt. When adding it in my procedure, it says is fails.

This procedure works
echo "%programfiles%"\Application\psftp.exe -be -l levi -pw levi -b "%programfiles%"\Application\uploadcommands.txt >>>>"%programfiles%\RemoteView\transfer.bat"

This procedure fails *note the < answerfile.txt
echo "%programfiles%"\Application\psftp.exe -be -l levi -pw levi -b "%programfiles%"\Application\uploadcommands.txt <answerfile.txt>>>>"%programfiles%\RemoteView\transfer.bat"

I am guessing Kaseya uses the less than symbol for something. I just need it to echo into a text file. Thanks in advance for the help!!

All Replies
  • So by default the greater and smaller symbols (><) are used to encapsulate managed variable names (<Managed Variable>), to use these symbols to pipe text or for other tasks you need to double them.

    This part "<answerfile.txt>" is read as a managed variable you are also missing the path for this file, the working path for kaseya procedures is "C:\Windows\system32" if you don't specify the path of a file it will make the assumption that the file is located in the working path.

  • ok so if I put the answerfile.txt file in \system32, is there any way to echo the command < answerfile.txt?

  • How many lines does your answer file have?

  • one, it has the letter y

  • change the <answerfile.txt>>>> to <<answerfile.txt >> >>>>

  • I am trying to echo this to a .bat file, then I will execute the bat file. This isnt working though

  • try this as a test, set up a test script to send a popup to you with the string and parameters you'd like, see what it shows up as. Does it match your string that works locally via the cmd line? this could help you figure out just the right <<>>> and such to meet your needs.

  • I think you have to escape the character first with a ^ or carat character.

    Example: echo < >test.txt

    ...results in "unexpected" error

    But this: echo ^< >test.txt

    ...gives us a file with the less than character in it

  • danrche -  How do I have it pop up like that? I could see it useful for testing.

    SMason - In a Agent Procedure, I am trying echo echo ^< >>c:\test.txt and it is giving me an error..

    Any other ideas?

  • Any time you want to use a greater than or less than symbol < > just put two of them to get Kaseya to output one of them. You can try the 'writetexttofile' command to skip having to do the echo to the first file, which would simplify it somewhat and make troubleshooting easier.

    Use the sendMessage step type with the 'Display Now' option to pop up a dialog box on the machine, and just copy and paste the whole command in there to see what it looks like once it gets to the machine.


    I didn't test this, I'll let you do that...

    [edited by: Ray Barber at 4:44 PM (GMT -8) on Mar 4, 2013] .
  • I believe your command in Kaseya will be: echo echo ^<< >>c:\test.txt

  • Possibly need to escape both less than characters: echo echo ^<^< >>c:\test.txt

  • So far, this is the only thing works

    echo ^<<^<< ss >>c:\testfile.txt

    The file looks like << ss. I cant figure out how to get just one less than symbol? Getting close guys! Thanks for the help!!

  • Levi,

    sorry about getting back so late, I usually use send message  which does a pop up on my PC put in my string there and then run it to see what Kaseya would inturput it as. see below.

    hope this helps

  • I can't seem to get my images loaded into this :( sorry

    create a "Send Message" procedure and put your string in the "Enter the Message to display:" part of that procedure. Check the box to use a display immediately popup and see what shows up.

    [edited by: danrche at 12:43 PM (GMT -8) on Mar 5, 2013] d