当前位置:首页 » 文件传输 » 如何抓取哪个程序访问了哪个目录
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

如何抓取哪个程序访问了哪个目录

发布时间: 2022-07-22 05:21:34

‘壹’ 电脑如何知道程序访问文件夹

通过核心提供的一些API接口,因为文件操作都是要经过这些接口的,所以操作系统会知道的

‘贰’ 如何查看文件夹被什么程序使用

工具/原材料

电脑。

1、在电脑的任务管理器页面中,点击“性能”按钮;

‘叁’ linux查看哪些程序在使用目录

1.列出文件清单命令:ls ls命令能够列出当前目录下的所有内容。ls 命令的执行方式为: # ls [-选项] [文件名或者目录名] 进入到Linux命令行中后,我们至少要知道当前所处的位置有哪些内容,这些信息就可以使用ls命令来获得。

‘肆’ 如何跟踪一个程序访问的文件

process monitor就行(它相当于以前的文件监控用的filemon加注册表监控regmon的合集) ,用这个软件可以监控到其它软件在运行时访问的各种文件和注册表,也可以针对性的只过滤出某一类操作,比如仅仅只限写入。

‘伍’ VC 如何根据进程名称找程序的目录

你首先需要为VC下载一个Microsoft
Platform
SDK
for
Windows
XP
SP2,有了这个包以后,将psapi.h和psapi.lib拷贝到VC的include和lib目录,采用PSAPI编程:
1、用EnumProcesses函数列出当前所有进程
2、用OpenProcess打开进程
3、用GetProcessImageFileName函数就可以获取程序的完整目录
上面三个函数的资料在互联网上很完整,你可以用函数名作为关键字搜索一下就知道了。
下面举个例子:
#include
<windows.h>
#include
<stdio.h>
#include
<tchar.h>
#include
<psapi.h>
#pragma
comment(lib,
"psapi.lib")
void
PrintProcessNameAndID(
DWORD
processID
)
{
TCHAR
szProcessName[MAX_PATH]
=
TEXT("<unknown>");
TCHAR
szProcessPath[MAX_PATH]
=
TEXT("<unknown>");
//
获取进程句柄
HANDLE
hProcess
=
OpenProcess(
PROCESS_QUERY_INFORMATION
|
PROCESS_VM_READ,
FALSE,
processID
);
//
获取进程名称和路径
if
(NULL
!=
hProcess
)
{
HMODULE
hMod;
DWORD
cbNeeded;
if
(
EnumProcessMoles(
hProcess,
&hMod,
sizeof(hMod),
&cbNeeded)
)
{
GetMoleBaseName(
hProcess,
hMod,
szProcessName,
sizeof(szProcessName)/sizeof(TCHAR)
);
}
GetProcessImageFileName(hProcess,
szProcessPath,
MAX_PATH);
}
//
打印进程名、进程号和路径地址.
_tprintf(
TEXT("%s
(PID:
%u)
<%s>\n"),
szProcessName,
processID,
szProcessPath
);
CloseHandle(
hProcess
);
}
void
main(
)
{
//
获取进程列表.
DWORD
aProcesses[1024],
cbNeeded,
cProcesses;
unsigned
int
i;
if
(
!EnumProcesses(
aProcesses,
sizeof(aProcesses),
&cbNeeded
)
)
return;
//
计算当前一共多少个活动进程
cProcesses
=
cbNeeded
/
sizeof(DWORD);
//打印进程信息
for
(
i
=
0;
i
<
cProcesses;
i++
)
if(
aProcesses[i]
!=
0
)
PrintProcessNameAndID(
aProcesses[i]
);
}

‘陆’ Java获取程序运行的当前工作目录

使用下面这个PathUtil的getProgramPath()就可以获得当前程序运行的目录。

import java.net.URL;
import java.net.URLDecoder;

class PathUtil {
/**
* Get the env of windir, such as "C:\WINDOWS".
*
* @return the env of windir value.
*/
public static String getWindir() {
return System.getenv("windir");
}

/**
* Get file separator, such as "/" on unix.
*
* @return the separator of file.
*/
public static String getFileSeparator() {
return System.getProperty("file.separator");
}

/**
* Get line separator, such as "\n" on unix.
*
* @return the separator of line.
*/
public static String getLineSeparator() {
return System.getProperty("line.separator");
}

/**
* Get programPath
*
* @return programPath
*/
public static String getProgramPath() {
Class<PathUtil> cls = PathUtil.class;
ClassLoader loader = cls.getClassLoader();
//
// Get the full name of the class.
//
String clsName = cls.getName() + ".class";
//
// Get the package that include the class.
//
Package pack = cls.getPackage();
String path = "";
//
// Transform package name to path.
//
if (pack != null) {
String packName = pack.getName();
//
// Get the class's file name.
//
clsName = clsName.substring(packName.length() + 1);
//
// If package is simple transform package name to path directly,
// else transform package name to path by package name's
// constituent.
//
path = packName;
if (path.indexOf(".") > 0) {
path = path.replace(".", "/");
}
path = path + "/";
}

URL url = loader.getResource(path + clsName);
//
// Get path information form the instance of URL.
//
String retPath = url.getPath();
//
// Delete protocol name "file:" form path information.
//
try {
int pos = retPath.indexOf("file:");
if (pos > -1) {
retPath = retPath.substring(pos + 5);
}
//
// Delete the information of class file from the information of
// path.
//
pos = retPath.indexOf(path + clsName);
retPath = retPath.substring(0, pos - 1);
//
// If the class file was packageed into JAR e.g. file, delete the
// file name of the corresponding JAR e.g..
//
if (retPath.endsWith("!")) {
retPath = retPath.substring(0, retPath.lastIndexOf("/"));
}

retPath = URLDecoder.decode(retPath, "utf-8");
} catch (Exception e) {
retPath = null;
e.printStackTrace();
}

return retPath;
}
}

测试类:
public class Test{
public static void main(String args[]){
String s = PathUtil.getProgramPath();
System.out.println(s);
}
}

‘柒’ java怎么获取程序所在根目录

System.getProperty("user.dir");这个试试

‘捌’ 怎样知道哪个程序正在访问文件

可以用“冰刃”。。
UNLOCKER也不错的。。只不过简单一些
冰刃操作上要复杂一些。。不过很详细。。

‘玖’ Linux如何查看进程访问哪个文件

1.查进程
ps命令查找与进程相关的PID号:
ps
a
显示现行终端机下的所有程序,包括其他用户的程序。
ps
-A
显示所有程序。
ps
c
列出程序时,显示每个程序真正的指令名称,而不包含路径,参数或常驻服务的标示。
ps
-e
此参数的效果和指定"A"参数相同。
ps
e
列出程序时,显示每个程序所使用的环境变量。
ps
f
用ASCII字符显示树状结构,表达程序间的相互关系。
ps
-H
显示树状结构,表示程序间的相互关系。
ps
-N
显示所有的程序,除了执行ps指令终端机下的程序之外。
ps
s
采用程序信号的格式显示程序状况。
ps
S
列出程序时,包括已中断的子程序资料。
ps
-t<终端机编号>
指定终端机编号,并列出属于该终端机的程序的状况。
ps
u
以用户为主的格式来显示程序状况。
ps
x
显示所有程序,不以终端机来区分。
最常用的方法是ps
a
...

‘拾’ 您好,请问c++如何读取此时运行程序的所在目录

获取当前目录的方法有很多,其中之一:
TCHAR szFilePath[MAX_PATH + 1];
GetMoleFileName(NULL, szFilePath, MAX_PATH);
(_tcsrchr(szFilePath, _T('//')))[1] = 0; //删除文件名,只获得路径
CString str_url = szFilePath; //str_url 中保存的是当前目录