ãªã Directory ãéãããã¾ã¾ã«ãªãã®ãï¼ ââ ã²ã¨ã¤ã®è§£
ã¤ãã§ã«ããä¸ç¹ï¼
ããã¡ã¤ã«ã®ä½¿ç¨è
ã調ã¹ã PowerShell Cmdletãã«å¯¾ãï¼ãããã£ã質åãããã ãã¾ããï¼
bear.mini ãã½ã¼ã¹ã³ã¼ãããã¦ã³ãã¼ãããã¦ããã ãã¾ããã(ä¸ç¥) ã¨ããã§ããã¡ã¤ã«ã ãã§ãªãããã£ã¬ã¯ããªã Lock ãã¦ããããã»ã¹ãèå¥ã§ããããã«ã¯ãªãã¾ããã§ããããï¼ãã£ã¬ã¯ããªå ã®ãã¡ã¤ã«ãå帰çã«ãã§ãã¯ããããã¨ããã¨ãã©ãããã£ã¬ã¯ããªèªä½ã®ãã§ãã¯ã®éã«ã¨ã©ã¼ãçºçãã¦ããããã§ãã®ã§ã»ã»ã»ãã
ãã¨ããããèãã¦ã¿ãã¨ï¼ç¢ºãã« Explorer ãããç¹å®ãã£ã¬ã¯ããªã ãæä½ã§ããªããªããã¨ãã¨ããã®ã¯å°ãªãããçµé¨ãããã¾ãï¼ä¸ã®ãã¡ã¤ã«ã¯åé¤ã§ããã®ã«ï¼ãªãã大å
ã®ãã£ã¬ã¯ããªãåé¤ãããã¨ããã¨ï¼ãå¥ã®ããã°ã©ã ããã®ãã©ã«ããéãã¦ããã®ã§ãæä½ãå®äºã§ãã¾ãããã¨ãããã¤ã¢ãã°ã表示ããã¦ãã¾ãã¨ããçµé¨ï¼çãããããã¾ãããï¼ï¼
ãã£ã¬ã¯ããªã®ãã¡ã¤ã«ãã³ãã«
ãã¦ï¼ä½ããã®ããã»ã¹ãä½ããã®å½¢ã§ãã©ã«ããéãã¦ããã®ã¯ç¢ºããããã¨ãã¦ï¼æ®æ®µ Win32 ããã°ã©ãã³ã°ãè¡ã£ã¦ãã身ããããã¨ï¼ããããããã£ã¬ã¯ããªã®ãã¡ã¤ã«ãã³ãã«ã£ã¦éããã£ãï¼ãã¨ããçåãããã¦ãã¾ãï¼
å®éã«ã¯ MSDN Library ã® CreateFile ã®é ã«ããããã«ï¼ãéããããæ£è§£ãªã®ã§ããï¼ã©ãã FILE_FLAG_BACKUP_SEMANTICS ãæå®ãã¦ç¹æ®ãªéãæ¹ãããå¿
è¦ãããããã§ãï¼
HANDLE handle = CreateFile( _T("c:\\test"), READ_CONTROL, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
ãããï¼ããã¯ã¢ããã½ãããè£ã§åãã¦ãããªãã¾ã ããï¼ãããªã¸ãã¦ããªåä½ãããããã»ã¹ããããªã«ãããã®ã§ããããï¼
ãã£ã¬ã¯ããªã®ãã¡ã¤ã«ãã³ãã« (åè)
ä¸æ¹ï¼id:NyaRuRu:20070808:p1 ã®å®é¨ããï¼ã©ããå
¨ã¦ã®ããã»ã¹ã¯æä½ã²ã¨ã¤ã®ãã£ã¬ã¯ããªãéãã¦ããããããã¨ãåããã¾ãï¼ããã¦å¤ãã®ããã»ã¹ã¯ï¼èªèº«ã® exe ãã¡ã¤ã«ãç½®ããã¦ãããã£ã¬ã¯ããªã®ãã³ãã«ãéãã¦ãã¾ãï¼ã©ããããã㯠FILE_FLAG_BACKUP_SEMANTICS ã¨ã¯é¢ä¿ãªãçç±ã§ï¼ããã»ã¹ããã£ã¬ã¯ããªã®ãã³ãã«ãææããä»çµã¿ãããããã§ãï¼
ã¡ãã£ã¨ããã¯ã¤ãºã§ããï¼ãããã®ç¶æ³è¨¼æ ããï¼ã©ããããã»ã¹ã®ã«ã¬ã³ããã£ã¬ã¯ããªãæªãããã«è¦ãã¦ãã¾ãï¼å®é¨ãã¦ã¿ãã¨ãã®ç´æã¯æ£ããï¼SetCurrentDirectory API ã«ãã£ã¦ã«ã¬ã³ããã£ã¬ã¯ããªãå¤æ´ããã¨ï¼ããã»ã¹ããã®ãã£ã¬ã¯ããªã®ãã¡ã¤ã«ãã³ãã«ããªã¼ãã³ãããã¨ãï¼Process Explorer ã handle.exe ã«ãã£ã¦ç¢ºããããã¾ããï¼å®é¨ç°å¢ã¯ Windows Vista Ultimate Edition æ¥æ¬èªçã§ãï¼
// c:\test ã®ãã¡ã¤ã«ãã³ãã«ãéããã BOOL ret = SetCurrentDirectory( L"c:\\test" );
æªéã®ã·ããªãª
ããã¾ã§æ¥ãã°ï¼ãã£ããã©ããã£ãã·ããªãªã§ããã©ã«ããåé¤ã§ããªããªãããï¼åã®ãã人ãªãããã¤ãæ³åãä»ãã¦ããã®ã§ã¯ãªãã§ããããï¼
ãã¨ãã° Windows ã®ããããã¦ãã¦ã«ï¼ããã¡ã¤ã«é¸æãã¤ã¢ãã°ã§ã«ã¬ã³ããã£ã¬ã¯ããªãå¤ãããã¨ãããã®ãããã¾ãï¼ãªãã°ã·ããªãªã¯ãããªæãï¼
- c:\test\hoge.txt ãããããã»ã¹ã®ãã¡ã¤ã«é¸æãã¤ã¢ãã°ã§éã (hoge.txt 㨠c:\test ã® 2 ã¤ã®ãã¡ã¤ã«ãã³ãã«ãéããã)
- hoge.txt ãéãã (hoge.txt ã®ãã¡ã¤ã«ãã³ãã«ãéãããã)
- hoge.txt ã Explorer ããåé¤ (ããã¯å¯è½)
- c:\test ã Explorer ããåé¤ãããã¨ãã¦ã¨ã©ã¼ (ããããã»ã¹ã®ã«ã¬ã³ããã£ã¬ã¯ããªã«ãªã£ãã¾ã¾ãªã®ã§åé¤ã§ããªã)
ä»ã«ãï¼c:\test\hoge.pptx ãããã«ã¯ãªãã¯ã§éããã¨ããï¼PowerPoint 2007 ã®ã«ã¬ã³ããã£ã¬ã¯ããªã c:\test ã«ãªã£ã¦ãã¾ã£ãã¨ãï¼conime.exe ã®ãããªå¸¸é§ããã»ã¹ã®ã«ã¬ã³ããã£ã¬ã¯ããªãä½ãã®æåã§ãã¹ã¯ãããä¸ã®ç¹å®ãã©ã«ãã«ãªã£ã¦ãã¾ã£ãã¨ãï¼è²ã
ã¨ããªã¨ã¼ã·ã§ã³ã¯ããããã§ãï¼
以ä¸ï¼å¤ã®å¤ã®ã¡ãã£ã¨æã話ã§ããï¼