我有一个文件夹树,像这样(这只是一个例子,在我的真实情况下会更深入):
C:\test
|
+---folder1
| foo bar.txt
| foobar.txt
|
+---folder2
| foo bar.txt
| foobar.txt
|
\---folder3
foo bar.txt
foobar.txt
Run Code Online (Sandbox Code Playgroud)
我的文件名称中有一个或多个空格,我需要对它们执行命令,所以我对 foo bar.txt 感兴趣,但对 foobar.txt 不感兴趣。
我试过(在批处理文件中):
for /r test %%f in (foo bar.txt) do if exist %%f echo %%f
Run Code Online (Sandbox Code Playgroud)
其中命令是简单的echo.
它不起作用,因为空间被跳过并且我没有得到任何输出。
这有效,但不是我需要的:
for /r test %%f in (foobar.txt) do if exist %%f echo %%f
Run Code Online (Sandbox Code Playgroud)
它打印:
C:\test\folder1\foobar.txt
C:\test\folder2\foobar.txt
C:\test\folder3\foobar.txt
Run Code Online (Sandbox Code Playgroud)
我尝试使用引号 (") 但它不起作用:
for /r test %%f in ("foo bar.txt") do if exist %%f echo %%f
Run Code Online (Sandbox Code Playgroud)
它不起作用,因为引号仍包含在输出中:
C:\test\folder1\"foo …Run Code Online (Sandbox Code Playgroud) 是否可以在 Windows XP 中记录启动和关闭时间?我的意思是在系统事件日志中记录这些事件。
例如我可以像这样破解一个 jscript
// this is log_startup.js
var shell = WScript.CreateObject("WScript.Shell");
shell.LogEvent(0, "Startup timestamp = " + Date() );
Run Code Online (Sandbox Code Playgroud)
然后将其添加cscript /nologo log_startup.js到启动菜单文件夹中,但我更喜欢 Windows 的“本机”方式(顺便说一下,我不知道如何检测关机)。
谢谢你。