Sysinternals/Pstools/psfile

From aldeid
Jump to navigation Jump to search
You are here:
PsFile

Description

PsFile is part of the PsTools toolkit developed by Sysinternals. It lists or closes files opened remotely.

Installation

PsExec is part of the PsTools suite. To install it, please refer to this section.

Usage

Syntax

Usage: psfile [\\RemoteComputer [-u Username [-p Password]]] [[ID | path] [-c]]

Omitting a file identifier has PsFile list all files opened remotely.

Options

-u
Specifies optional user name for login to remote computer.
-p
Specifies password for user name.
ID
Id of file to print information for or close.
Path
Full or partial path of files to match.
-c
Closes file identified by file Id.

Examples

List processes

Following example shows processes opened with the PsExec command used to remotely open calc.exe in interactive mode.

C:\pstools>psfile \\192.168.1.27 -u pilou -p oopsoops

psfile v1.02 - psfile
Copyright ® 2001 Mark Russinovich
Sysinternals

Files opened remotely on 192.168.1.27:

[87] \PIPE\psexecsvc
    User:   PILOU
    Locks:  0
    Access: Read Write
[88] \PIPE\psexecsvc-WILLIAM-PC-1924-stdin
    User:   PILOU
    Locks:  0
    Access: Write
[89] \PIPE\psexecsvc-WILLIAM-PC-1924-stdout
    User:   PILOU
    Locks:  0
    Access: Read
[90] \PIPE\psexecsvc-WILLIAM-PC-1924-stderr
    User:   PILOU
    Locks:  0
    Access: Read
[91] \PIPE\srvsvc
    User:   PILOU
    Locks:  0
    Access: Read Write
  • Processes 87 to 90 have been created by the psexec command.
  • Process 91 corresponds to the psfile command.

Close processes

To close processes, you can use following commands:

C:\pstools>psfile \\192.168.1.27 -u pilou -p oopsoops 88 -c

psfile v1.02 - psfile
Copyright ® 2001 Mark Russinovich
Sysinternals

Closed file \PIPE\psexecsvc-WILLIAM-PC-1924-stdin on 192.168.1.27.
C:\pstools>psfile \\192.168.1.27 -u pilou -p oopsoops 89 -c

psfile v1.02 - psfile
Copyright ® 2001 Mark Russinovich
Sysinternals

Closed file \PIPE\psexecsvc-WILLIAM-PC-1924-stdout on 192.168.1.27.
C:\pstools>psfile \\192.168.1.27 -u pilou -p oopsoops 90 -c

psfile v1.02 - psfile
Copyright ® 2001 Mark Russinovich
Sysinternals

Closed file \PIPE\psexecsvc-WILLIAM-PC-1924-stderr on 192.168.1.27.

Comments