Kaseya Community

What is wrong with this script logic?

This question is answered

I'm building a script that takes input from a file, then processes a command. I've simplified it here to just do an echo. The script fails when it executes this line, and I can't figure out why.

for /F "tokens=1" %A in (drives.txt) do echo %A >>>> #vAgentConfiguration.agentTempDir#\result.txt

If I run the following command at a command prompt, it's fine:

for /F "tokens=1" %A in (drives.txt) do echo %A >> result.txt

Drives.txt is a simple text file that has two lines in it that say

C:
D:

Any ideas?

Verified Answer
  • It may not be finding the drives.txt file.  I would try specifiying the full path to drives.txt

All Replies
  • It may not be finding the drives.txt file.  I would try specifiying the full path to drives.txt

  • Right in front of me the whole time. Thanks for the catch!