使用vbs在homedrive中查找pst扩展文件?

时间:2014-09-16 09:33:53

标签: vbscript

我在homedrive中找到pst文件时遇到问题。首先,我尝试在本地磁盘中查找 它通过使用这些查询

就像一个魅力
  Select * from CIM_DataFile Where Extension = 'pst'

现在我正在尝试在家庭驱动器中找到pst文件,但无法使用这些代码提取文件:

  Select * from win32_mappedlogicaldisk

我希望有人可以帮我解决这个问题,并提前感谢你。

1 个答案:

答案 0 :(得分:0)

嗯..我通常使用阻力最小的路径。

此批次应适用于......

用法是:SomeNameHere.bat pst

您可以从For循环中替换%1并删除第一个IF语句。然后添加一些命令来处理PST文件。

    @echo off
    :: Using call :label - within a loop will let called label run until end
    :: of batch file.
    :: When the end of file is reached, it goes to the next line in loop.
    if "%1" equ "" goto showusage
    setlocal enabledelayedexpansion
    for /f "tokens=* delims=" %%a in ('dir /s /b /a /o *.%1') do (
    set file=%%a
    call :function0
    )
    endlocal
    goto eof

    :function0
    if "%file%" neq "" goto function1
    if "%file%" equ "" goto function2
    goto function0 

    :function1
    set %file%=%file:&:^&%
    echo.Found %file%
    ::some commands here
    goto eof

    :function2
    echo. 
    goto eof

    :showusage
    cls
    Echo.You did not supply a file extension to search for.
    Echo.
    Echo.Please run the command like this example
    Echo.
    echo.   %~nx0 txt
    Echo.

    :eof