T
T
tartarelin2014-12-08 13:01:14
cmd/bat
tartarelin, 2014-12-08 13:01:14

How to open and close an explorer window from the command line?

There is a computer not in the domain, it has a DFS folder connected as a network drive, but only those folders that are located on the server where DFS is raised are opened, the remaining folders are opened only after the first access to them through Explorer.
There was an idea to fasten a batch file that will access these computers, but c
powershell cd \\srv\share
did not work, it turned out on a test computer, not on a specific one, only through
explorer \\srv\share
but then every time you turn on the computer there will be several windows, which will be great annoying over time, how to close open explorer windows?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
asdz, 2014-12-08
@tartarelin

Open the folder explorer \\srv\share or start \\srv\share
Close the window: set the explorer to launch each window in a separate process (in the settings for displaying files and folders, it seems),
Get the pid of the explorer process for the window you need:
tasklist / V / FI "WindowTitle eq srv*"
Image Name PID Session Name Session# Mem Usage Status User Name CPU Time Window Title
=========================== ==========================================
cmd.exe 12023 Console 1 1,192 K Running
Kill process by pid
taskkill /f //pid pid

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question