Skip to content
조회 수 6508 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄


내 문서’가 열리는 것

%windir%\explorer.exe /e


이번엔 ‘컴퓨터’가 나타납니다.

%windir%\explorer.exe /e,


%windir%\explorer.exe 끝에 내가 원하는 드라이브 명을 넣을 수도 있습니다.

%windir%\explorer.exe F:\


F:\ETC 와 같이, 특정 폴더를 지정하는 것도 물론 가능하답니다.

%windir%\explorer.exe F:\ETC





기타 갖가지 . . .


How to use Explorer to show special objects

The Windows Shell program, Explorer.exe, is stored in the Windows folder, obtained through the environment variableWinDir. Usually, this folder is a part of the PATH environment variable. And as a consequence, we don't need to specify the whole path to Explorer.exe when calling this program.

The table below summarizes some of the command-line parameters passed to Explorer and the result of the execution. Note that all the examples given in this table have been tested only on the Windows XP platform. There is no reason that these examples will not work on at least NT-platforms (NT4/2K/XP/2003). The general Explorer command-line syntax is well known, and can be found on many Internet sites (see for example, the Q130510 article on the Microsoft site). But, the article's main contribution consists in showing how to specify some parameters (X, Y)=(object, sub-object) (see next section) to show special objects like My ComputerMy DocumentsControl Panel etc. Some of these objects are available in the Start Menu of the tasks bar (one of the graphical parts of the Explorer). To try the examples below, just open a console (cmd or command depending on your OS) and copy/paste each example. If you want to play with them, I have provided two complete and very small applications coded in Visual C++ 6 and Visual Basic 6. Some details of these applications are given below in the next sections.

Explore what?Command-line

Object X and optionally sub-object Y (general case)

General syntax:

Explorer [/n][/e][,/root],X,[[/Select],Y]

Notes:

  • Use /e to show the left Explorer pane (TreeView) together with the right pane (ListView).
  • Use /n to hide the left Explorer pane (TreeView).
  • If /root is present, we start exploring at the root object (X) and objects belonging to X.
  • If /root is not present, we explore the object X, its children, and other Explorer objects as well.

Examples:

  1. Exploring drive C: only with Folders panel and then without it:

    Explorer /E,/Root,C:

    Explorer /Root,%SystemDrive%

  2. Exploring Windows directory only:

    Explorer /E,/Root,%windir%

  3. Exploring the Logon Server (you can use UNC paths) only:

    Explorer /E,/Root,%LogonServer%

  4. Exploring the current user profile path only:

    Explorer /E,/Root,%HOMEDRIVE%%HOMEPATH%

  5. Exploring the System32 folder and putting the focus on thecalc.exe program:

    Explorer /N,%windir%\system32,/select,%windir%\system32\calc.exe

My Computer

Explorer /E,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

Explanation: The object My Computer is a namespace which has the CLSID: {20D04FE0-3AEA-1069-A2D8-08002B30309D}

Control Panel

Explorer /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}

Explanation: The Control Panel object whose CLSID is: {21EC2020-3AEA-1069-A2DD-08002B30309D} is a sub-object ofMy Computer.

Printers and telecopiers

Explorer /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{2227A280-3AEA-1069-A2DE-08002B30309D}

Fonts

Explorer /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{D20EA4E1-3957-11d2-A40B-0C5020524152}

Scanners and Cameras

Explorer /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{E211B736-43FD-11D1-9EFB-0000F8757FCD}

Network Neighbourhood

Explorer /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}

Administration Tools

Explorer /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{D20EA4E1-3957-11d2-A40B-0C5020524153}

Tasks Scheduler

Explorer /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}

Web Folders

Explorer /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{BDEADF00-C265-11D0-BCED-00A0C90AB50F}

My Documents

Explorer /N,::{450D8FBA-AD25-11D0-98A8-0800361B1103}

Recycle Bin

Explorer /N,::{645FF040-5081-101B-9F08-00AA002F954E}

Network Favorites

Explorer /N,::{208D2C60-3AEA-1069-A2D7-08002B30309D}

Default Navigator

Explorer /N,::{871C5380-42A0-1069-A2EA-08002B30309D}

Computer search results folder

Explorer /N,::{1F4DE370-D627-11D1-BA4F-00A0C91EEDBA}

Network Search Results computer

Explorer /N,::{E17D4FC0-5564-11D1-83F2-00A0C90DC849}

Where the CLSIDs of special Explorer objects can be found?

There are many ways to find the CLSIDs referenced in the examples given in the previous section. Three methods are given below:

The first place to look for is the registry in the hive: HKEY_CLASSES_ROOT\CLSID, for example. Some of the special CLSIDS can also be found in the registry keys where the related namespace extensions are specified as in the key:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\ CurrentVersion\Explorer\ControlPanel\NameSpace\ where you can find all CLSIDs related to the Control Panel.

The second place to look for, is the OS shell resources DLL shell32.dll. To find the CLSIDs, you have to follow these steps:

  • Step 1: Launch VS6, for example.
  • Step 2: Click on the menu File-Open, and select file type: Executable Files, Open as: Resources, and then select the file shell32.dll, which is found in the System32 system folder (if the DLL is locked, you have to make a copy of it elsewhere and open it from the new place):

  • Step 3: Open the custom resources "REGINST" as indicated in the figure below. Open this resource, and you will find all default CLSIDs installed on your OS. In fact, this file has the INF file format, and the CLSIDs can be found in the [Strings] section. All CLSIDs are prefixed by CLSID_.

    Note that you can also use public tools more appropriated to edit resources like: Resource Hacker by Angus Johnson.

The third place, is the Windows CD setup in the i386 folder in a INF file used during the installation process. If you have a Windows XP CD setup, you can find these CLSIDs in the HIVECLS.INF file.

Application 1

The application is a MFC Dialog application whose UI is illustrated at the top of this article. The design-time UI is illustrated below:

To test this application, you have to do three things:

  1. Choose in the list, one of the objects.
  2. Optionally, choose one of the two options or both of them.
  3. Click on the button " GO TO -->!" in order to display the appropriate object.

The main procedure responsible for displaying the chosen object in the combo-box list corresponding to the click on the button labeled "GO TO -->!" is given below, and doesn't need any explanation for people comfortable with Microsoft C++:

void CExploreWinObjectsDlg::OnExploreWhat()
{
     #define    LIST_ITEMS_NUM    15
    
     //    Define objects paths array

     CString CLSIDs[LIST_ITEMS_NUM] =
     { /*My Computer*/
         _T("{20D04FE0-3AEA-1069-A2D8-08002B30309D}"), /*Control Panel*/
         CLSIDs[0] + CString("\\::{21EC2020-3AEA-1069-A2DD" 
                     "-08002B30309D}"), /*Printers and telecopiers*/
         CLSIDs[1]+CString("\\::{2227A280-3AEA-1069-A2DE" 
                     "-08002B30309D}"), /*Fonts*/
         CLSIDs[1]+CString("\\::{D20EA4E1-3957-11d2-A40B" 
                     "-0C5020524152}"), /*scanners and cameras*/
         CLSIDs[1]+CString("\\::{E211B736-43FD-11D1-" 
                     "9EFB-0000F8757FCD}"), /*Networkhood*/
         CLSIDs[1]+CString("\\::{7007ACC7-3202-11D1-AAD2" 
                     "-00805FC1270E}"), /*Administration tools*/
         CLSIDs[1]+CString("\\::{D20EA4E1-3957-11d2" 
                     "-A40B-0C5020524153}"), /*Tasks Scheduler*/
         CLSIDs[1]+CString("\\::{D6277990-4C6A-11CF" 
                     "-8D87-00AA0060F5BF}"), /*Web    folders*/
         CLSIDs[0]+CString("\\::{BDEADF00-C265-11D0" 
                     "-BCED-00A0C90AB50F}"), /*My documents*/
         _T("{450D8FBA-AD25-11D0-98A8-0800361B1103}"), /*Recycle Bin*/
         _T("{645FF040-5081-101B-9F08-00AA002F954E}"), /*Network favorites*/
         _T("{208D2C60-3AEA-1069-A2D7-08002B30309D}"), /*Default Navigator*/
         _T("{871C5380-42A0-1069-A2EA-08002B30309D}"), /*Results of 
                                                         Computers research*/
         _T("{1F4DE370-D627-11D1-BA4F-00A0C91EEDBA}"), /*Results 
                                                         of files research*/
                                    
         _T("{E17D4FC0-5564-11D1-83F2-00A0C90DC849}")
     };
    
     char Windir[MAX_PATH];
     if (GetWindowsDirectory(Windir,MAX_PATH)>0) 
     {
         //    Get selected item index

         int SelIndex = 
             SendDlgItemMessage(IDC_COMBO1, CB_GETCURSEL, 0, 0);
       
         //    Get options values

         BOOL DoNotShowLeftPane=(BOOL)IsDlgButtonChecked(IDC_CHECK1);
         BOOL StartExplAtRoot=(BOOL)IsDlgButtonChecked(IDC_CHECK2);
    
         for (int i=0; i< LIST_ITEMS_NUM; i++) {
            if (SelIndex==i) {
                char cmdline[MAX_PATH];
                char HowExplore[10];
                char StartAtRoot[10];
                    
                wsprintf(HowExplore, "%s", 
                       (DoNotShowLeftPane==TRUE)?"/N":"/E");
                wsprintf(StartAtRoot, "%s", 
                       (StartExplAtRoot==TRUE)?"/Root,":"");
                wsprintf(cmdline,"%s\\Explorer.exe %s,%s::%s", 
                       Windir, HowExplore, StartAtRoot, CLSIDs[i]);
                
                // don't care about ExitCode,

                // since we don't wait the end of the process

                DWORD ExitCode=0;
                BOOL bRet=CreateProc("", cmdline, FALSE, 0, 
                                            TRUE, ExitCode);
                
                //    Get out of the for loop

                break;
            }
         }
     } 
     else 
     {
         MessageBox("Error in GetWindowsDirectory() API!", 
                                "",MB_OK|MB_ICONEXCLAMATION);}
}

Application 2

The second application is a VB 6 example using Internet Explorer Control whose UI is illustrated as the second figure at the top of this article. I want in this application to give another approach using Explorer objects different from the one used in VC++ sample application. The code is quite simple and makes use of one call to the Windows APIGetClientRect declared as:

Private Declare Function GetClientRect Lib "user32" (_
                    ByVal hwnd As Long, lpRect As rect) As Long

in order to resize the form. Note that in VB objects, dimensions are measured in Twips units, and since this API returns the window client rectangle in Pixels units, we have to convert these dimensions to Twips by using theScreen object properties : TwipsPerPixelX and TwipsPerPixelY (see the event Form_Resize() content). In order to display the Explorer objects, I have used the Internet Explorer method Naviagte2 with no optional parameters in the event handler cboObjects_Click(). The complete code is given below:

OptionExplicit 
'API declaration with parameters types

Private Type rect
    Left As Long
    Top As Long 
    Right As Long 
    Bottom As Long 
End Type
 
Private Declare Function GetClientRect Lib "user32" _
            (ByVal hwnd As Long, lpRect As rect) As Long 

'define Explorer objects paths array variable

Dim objExpArray(0 To 14) As String 

Private Sub cboObjects_Click() 
    WebBrowser1.Navigate2 objExpArray(cboObjects.ListIndex)
End Sub 

Private Sub Form_Load() 
      
    'define Explorer objects paths array variable values 

    'My computer

    objExpArray(0)= "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" 
    'Contro panel

    objExpArray(1) = objExpArray(0) + _
        "\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"  
    'Printers and telecopiers 

    objExpArray(2) = objExpArray(1) + _
        "\::{2227A280-3AEA-1069-A2DE-08002B30309D}" 
    'Fonts

    objExpArray(3) = objExpArray(1) + -
        "\::{D20EA4E1-3957-11d2-A40B-0C5020524152}" 
    'Scanners and Cameras

    objExpArray(4) = objExpArray(1) + -
        "\::{E211B736-43FD-11D1-9EFB-0000F8757FCD}"
    'Networkhood 

    objExpArray(5) = objExpArray(1) + _
        "\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}" 
     'Administration tools

    objExpArray(6) = objExpArray(1) + _
        "\::{D20EA4E1-3957-11d2-A40B-0C5020524153}"
    'Tasks Scheduler 

    objExpArray(7) = objExpArray(1) + _
        "\::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}"
    'Web folders 

    objExpArray(8) = objExpArray(0) + _
        "\::{BDEADF00-C265-11D0-BCED-00A0C90AB50F}" 
    'My documents 

    objExpArray(9) = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" 
    'Recycle Bin 

    objExpArray(10)= "::{645FF040-5081-101B-9F08-00AA002F954E}" 
    'Network favorites 

    objExpArray(11)= "::{208D2C60-3AEA-1069-A2D7-08002B30309D}" 
    'Default Navigator

    objExpArray(12)= "::{871C5380-42A0-1069-A2EA-08002B30309D}"
    'Results of Computers research 

    objExpArray(13)= "::{1F4DE370-D627-11D1-BA4F-00A0C91EEDBA}" 
    'Results of files research

    objExpArray(14) = "::{E17D4FC0-5564-11D1-83F2-00A0C90DC849}" 
    
    'go to My Computer by default

    cboObjects.ListIndex = 0 
End Sub 

Private Sub Form_Resize()
    Dim CliRect As rect

    If GetClientRect(Me.hwnd, CliRect) > 0 Then
        Me.WebBrowser1.Move 0, Me.cboObjects.Height, _
                    CliRect.Right * Screen.TwipsPerPixelX, _
                    CliRect.Bottom * Screen.TwipsPerPixelY _
                    - Me.cboObjects.Height
    End If
End Sub



대상부분을 아래와 같이 수정한다.

%windir%\explorer.exe /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

다른 폴더를 설정하려면 아래 값을 참조하면 된다.

바로가기 - 대상 부분에 기존 %windir%\explorer.exe 에 추가  /n, /e, c:\
%windir%\explorer.exe /n, /e, c:\ 같이 셋팅후 확인하면 탐색기 클릭시 C드라이브 폴더 열림

또는 '내컴퓨터'를 기본으로 하려면 아래와 같이 입력하면 된다.
%windir%\explorer.exe /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

My Computer

%SystemRoot%\explorer.exe /E,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

My Documents

%SystemRoot%\explorer.exe /N,::{450D8FBA-AD25-11D0-98A8-0800361B1103} 

Recycle Bin

%SystemRoot%\explorer.exe /N,::{645FF040-5081-101B-9F08-00AA002F954E}

Network Neighborhood
%SystemRoot%\explorer.exe /N,::{208D2C60-3AEA-1069-A2D7-08002B30309D}

Default Web Browser or Navigator (IE, Firefox, Safari, Google Chrome)

%SystemRoot%\explorer.exe /N,::{871C5380-42A0-1069-A2EA-08002B30309D}

Computer Search Results Folder
%SystemRoot%\explorer.exe /N,::{1F4DE370-D627-11D1-BA4F-00A0C91EEDBA}

Network Search Results Folder
%SystemRoot%\explorer.exe /N,::{E17D4FC0-5564-11D1-83F2-00A0C90DC849}

Web Folders

%SystemRoot%\explorer.exe /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{BDEADF00-C265-11D0-BCED-00A0C90AB50F}

Control Panel

%SystemRoot%\explorer.exe /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}

Printers and Faxes
%SystemRoot%\explorer.exe /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{2227A280-3AEA-1069-A2DE-08002B30309D}

Scanners and Cameras 
%SystemRoot%\explorer.exe /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{E211B736-43FD-11D1-9EFB-0000F8757FCD}

Fonts
%SystemRoot%\explorer.exe /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{D20EA4E1-3957-11d2-A40B-0C5020524152}

Network Connections or My Network Place

%SystemRoot%\explorer.exe /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}

Administrative Tools
%SystemRoot%\explorer.exe /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{D20EA4E1-3957-11d2-A40B-0C5020524153}

Tasks Scheduler

%SystemRoot%\explorer.exe /N,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}




로그인 후 댓글쓰기가 가능합니다.

?

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소