| |

VerySource

 Forgot password?
 Register
Search
View: 696|Reply: 1

★★ ☆ First aid! !! !! About Win32_Directory or Win32_ShortcutFile of WMI ☆ ★★

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-2 18:00:02
| Show all posts |Read mode
SelectQuery query = new SelectQuery ("select * from Win32_Directory WHERE Drive = 'F:'");
ManagementObjectSearcher searcher = new ManagementObjectSearcher (query);

foreach (ManagementBaseObject disk in searcher.Get ())
{
tn.Text = disk ["VolumeName"]. ToString () + "(" + disk ["Name"]. ToString () + ")";

}

Now use WMI's Win32_Directory to query all files under the F drive. But now I don't want to query all the paths I want to specify
select * from Win32_Directory WHERE Drive = 'F:' and Path = '\\Documents and Settings\\' so that nothing can be queried. . Expert advice! !! !!
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-20 17:45:01
| Show all posts
1) "VolumeName" should be in win32_logicaldisk
2) Pay attention to escape characters
select * from Win32_Directory WHERE Drive='F:' and Path = '\\Documents and Settings\\'

It should be select * from Win32_Directory WHERE Drive='F:' and Path = '\\\\Documents and Settings\\\\'
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list