3 Replies Latest reply on Oct 7, 2009 6:11 PM by Bill Robinson

    Using a parameter in custom commands

      I am trying to develop a custom command to review a log file while a process is running on a Windows server. I'd like to use a custom command that would look like this (in theory):

       

      tail -f //%H/??TARGET.SYSTEMROOT??/svcpack.log

      The "%H" macro resolves properly, but it seems to be choking on the parameter:

       

      tail: //MY_SERVER/??TARGET.SYSTEMROOT??/svcpack.log: Invalid argument

       

      Is there any way to pipe that kind of parameter into the custom command? I've also tried %SYSTEMROOT% and $SYSTEMROOT, but neither of those works either (and they would also not resolve to the proper NSH format of /C/WINNT, I'm guessing).

        • 1. Re: Using a parameter in custom commands
          Bill Robinson

          From what I've found you can't reference properties from a custom command.

           

          you could create a generic tail command that works on files and uses some of the other '%' operators like %p, etc...

          • 2. Re: Using a parameter in custom commands

            The docs tell me about %h, which I understand, and %f and %p which I am unclear on. Is there a more thorough reference somewhere?

            • 3. Re: Using a parameter in custom commands
              Bill Robinson

              %h The names of selected servers on which the command should run.

              %p The full path to the selected files or directories on which the command should run. This path does not include the server name. For example, a path might read /c/winnt rather than //host1/c/winnt.

              %f Selected files or directories on which the command should run, excluding the path to those files or directories. For example, winnt rather than /c/winnt.

               

               

              so %p is the path to the file or directory w/o the server... %f is basically just the file or directory name... in your case you want to make something like:

              tail -f //%h%p

               

              I'm not sure what %f would be used for - maybe if i needed to pass a file name to a command like 'ps -ef | grep %f' or something.