※ システム的に重大な処理なので、自信のない場合は使用せずに、GUI で指定して下さい 通常、Windows の既存のディレクトリ( マイ ドキュメント等 ) に追加でディレクトリを作成すると上記画像のようになると思います。 通常ならはこれて十分なのですが、サーバーアプリケーション(WWWサーバー等) の場合、現在ログインしているユーザとは別のユーザで処理されるので、ほぼ確実にこのままでは問題が出ます。 GUI でこのまま追加して権限を与えれば良いのですが、結構煩雑で管理上スマートでもありません。そこで、Microsoft が提供してくれている、VBScript のツールを使用します ( Extended Change Access Control List Tool (Xcacls) ) 使用する前の準備 まず、ダウンロードして解凍(実行すると解凍されます)すると、Xcacls.vbs が現れるので、パスの通ったディレクトリに移し、同じディレクトリに以下のようなバッチファイルを作成します( 仮に vbscacls.bat とします ) Windows7 で使用するには、3400 行目を Case "5.0", "5.1", "5.2", "6.1" に変更します( 6.1 が Windows7 )
cscript.exe %~dp0XCACLS.vbs %1 /E %2 %3 %4 %5 %6 %7 %8 %9
第一引数は、必ず対象のディレクトリかファイルで、/E が修正モードという意味で、これが無いと既存の情報が削除されてしまいます 追加 通常、ユーザーを単独で追加するよりグループを追加して対応します。Users で フルコントロールを与えれば、自分の PC としては問題は無いと思いますので、以下のようなパラメータで実行します( カレントディレクトリが対象 )
VBSCACLS "%CD%" /P users:F
削除 指定したグループ(ユーザ)のみ削除されます
VBSCACLS "%CD%" /R users
補足情報 Windows7 用に変更しないと、以下のようなメッセージが出力されますC:\TEMP>VBSCACLS "%CD%" /P users:F C:\TEMP>cscript.exe C:\Windows\XCACLS.vbs "C:\TEMP" /E /P users:F Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Starting XCACLS.VBS (Version: 5.2) Script at 2013/12/11 9:54:57 ************************************************ * Script not tested on this version of Windows * ************************************************ This script hasn't been tested on version "6.1" of Windows. Currently, the script has been tested on the following: Win2000, WinXP, Win2003 Previous versions of Windows NT can use: "XCACLS.EXE" from the NT 4.0 Resource Kit. For more recent versions, there may be an update to this script. Please contact David Burrell (dburrell@microsoft.com) Note: WMI must be installed for this script to function. If you need to run this script on the current OS, and you verified WMI is installed, do the following: open this script in Notepad search for Function IsOSSupported() change this line: Case "5.0", "5.1", "5.2" to: Case "5.0", "5.1", "5.2", "6.1" Save the script. Exiting script now. Operation Complete Elapsed Time: 4.296875E-02 seconds. Ending Script at 2013/12/11 9:54:57
以下は処理が正常終了した時のメッセージですC:\TEMP>VBSCACLS "%CD%" /P users:F C:\TEMP>cscript.exe C:\Windows\XCACLS.vbs "C:\TEMP" /E /P users:F Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Starting XCACLS.VBS (Version: 5.2) Script at 2013/12/11 9:58:05 Startup directory: "C:\TEMP" Arguments Used: Filename = "C:\TEMP" /E (Edit ACL leaving other users intact) /P (Replace rights) users:F - Changing /P user/group: "users" to "BUILTIN\Users" ************************************************************************** Directory: C:\TEMP Replacing NTFS rights (F access for This Folder, Subfolders and Files) for "BUIL TIN\Users" Completed successfully. ************************************************************************** Operation Complete Elapsed Time: 4.941406 seconds. Ending Script at 2013/12/11 9:58:10関連する記事 ディレクトリの権限を変更する Xcacls.vbs と Xcacls.exe
|
【コマンド : コマンドの最新記事】
- clip.exe ( クリップボードにコマンドラインからのコマンドの出力をリダイレクトします )
- XCOPY : ディレクトリごと新しいファイルのみをコピーする / Windows コンソールコマンド
- 他のアプリケーションを『管理者権限』で実行するコマンドライン
- コマンドプロンプト(実質はVBScript)で、クリップボードの内容をファイルに出力する
- コマンドプロンプトで XML整形
- 7zip のコマンドラインバージョン(7za.exe/920)の -r オプションはワイルドカードを指定した時だけのようです。
- コマンドプロンプト : WAV を mp3 に変換する
- PHP : HTTP コピーコマンド( ダウンロード )
- コマンドプロンプトのカラム数変更