Cannot list files on windows system

665 Views Asked by At

This is how I run the command, via staf, but it doesn't seem to list the files and folders under C:\Program Files
Even though the folder actually exists .. enter image description here

[root@server ~]# winPath="C:\Program Files"
[root@server ~]# staf remoteServer.com PROCESS START SHELL COMMAND 'dir "$winPath"' WAIT RETURNSTDOUT STDERRTOSTDOUT
Response
--------
{
  Return Code: 1
  Key        : <None>
  Files      : [
    {
      Return Code: 0
      Data       :  Volume in drive C has no label.
 Volume Serial Number is C052-46E0

 Directory of C:\Windows\system32

File Not Found

    }
  ]
}
1

There are 1 best solutions below

0
On BEST ANSWER

Surrounding path with double quotes directly in command worked ..

[root@server ~]# staf remoteServer.com PROCESS START SHELL COMMAND 'dir "C:\Program Files\"' WAIT RETURNSTDOUT STDERRTOSTDOUT
Response
--------
{
  Return Code: 0
  Key        : <None>
  Files      : [
    {
      Return Code: 0
      Data       :  Volume in drive C has no label.
 Volume Serial Number is C052-46E0

 Directory of C:\Program Files\

05/15/2014  05:46 PM    <DIR>          .
05/15/2014  05:46 PM    <DIR>          ..
05/12/2014  01:47 PM    <DIR>          logs
05/06/2014  08:14 AM    <DIR>          properties
               7 File(s)    225,032,824 bytes
              24 Dir(s)  15,758,508,032 bytes free

    }
  ]
}