Kaseya Community

#### What's wrong in this shell command?

`Hi guys,I execute one procedure that use shell command to looking for a files or folders and write your result in a text file, but the text file was empty. In the agent logs this procedure was execute without errors, someone knows what happend?The shell command that I executing is: dir c: /s /b | find /i "", with a system account.Any ideia?Thanks in advance.`
• The key to problem solving commands like this is to test it manually under the command line and if it still does not work to break it up into smaller parts.

The problem you are running into is you are doing the directory search from the c:\Windows\system32\ path because you used dir c: instead of dir c:\

Using dir C: starts the search from the current path that you are in and dir c:\ starts from the root of C drive. The agent uses the system account which in turn uses the c:\Windows\system32 as its default working path

[edited by: HardKnoX at 12:45 PM (GMT -8) on Dec 19, 2012] typo
All Replies
• dir c: /s /b | find /i ""

find must change in findstr

you have to declare something between the quotes

ex.  dir c: /s /b | findstr /i "sym*.*"  will list all files beginning with  "sym"

• @ Sloeber70: The dir c: /s /b | find /i ""  I post to be generic, but when I insert a file that exists in my machine the result continue empty

• The key to problem solving commands like this is to test it manually under the command line and if it still does not work to break it up into smaller parts.

The problem you are running into is you are doing the directory search from the c:\Windows\system32\ path because you used dir c: instead of dir c:\

Using dir C: starts the search from the current path that you are in and dir c:\ starts from the root of C drive. The agent uses the system account which in turn uses the c:\Windows\system32 as its default working path

[edited by: HardKnoX at 12:45 PM (GMT -8) on Dec 19, 2012] typo
• @HardKnox: Really thanks!!!! Problem Solved