Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
During my NSIS setup script for a WinForms app, I use the following CACLS command to give the Users group full rights to a subfolder:
Exec 'CACLS "$INSTDIR\SubFolder" /E /T /C /G "Users":F'
So in effect the CACLS command executed is something like:
CACLS "c:\Program Files\MyApp\SubFolder" /E /T /C /G "Users":F
When I then look at the Folder permissions in Windows Explorer (right click on the folder and choose Properties, go to the Security tab), the correct permissions are there but they are uneditable.
Furthermore, clicking the Advanced button for the 'Advanced Security Settings' shows that SubFolder is inheriting the "Users" group permissions from a 'Parent Object', but what is that Parent Object, because its not the folder above.
Why are the permissions added by CACLS uneditable, and why are they inherited from nonexistent parent object? I thinking I may have set the options on CACLS wrong.
I'm on Windows XP.
I think I figured it out: Changing CACLS to use /P 'replace' rather than /G 'grant' seemed to work better:
CACLS "c:\Program Files\MyApp\SubFolder" /E /T /C /P "Users":F
The options that got created were then editable in the Windows Explorer 'security' tab.
NSIS has a plugin to set permissions, you should probably use that (I can't remember if XP Home even has cacls)
The inherited permission for "Users" has to come from somewhere clearly, either the root of the drive or a parent of your parent folder (The advanced security dialog should have a inherited from column in the list)
Related
I recently upgraded to Windows 10 from 7 on all of my computers, I have 4. I use Cobian backup which used to work fine on windows 7 however on 10 the shares of the folders aren't set correctly and although they say they are shared they don't appear across the network so I cant back them up.
I have however found I can go into each folder and change the permissions manually and they do appear but the problem is I have around 500 folders so I wanted to know if there was a quick command or batch file that could be run to set sharing permissions to everyone for every folder in the parent folder so I don't have to do it individually?
Try toggling the inheritance on the main parent folder. The permissions should trickle down.
You can use the icacls to change the permissions, like
icacls "C:\myFolder" /grant Everyone:M
For changing permissions to all sub directories you can use a for loop and give folder name to the icacls command,
#echo off
set Dir=C:\FolderName
for /d /r "%Dir%" %%a in (*) do (
echo Setting permissions for %%~dpa Folder
icacls %%~dpa /grant Everyone:M
)
Adjust set Dir = C:\FolderName with your path (base Folder).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to make a .bat file that when opened will copy a folder and all it contains into another folder on another partition. Here is exactly what I am trying to do:
Copy C:\Documents and Settings\user\Desktop\Документи and all it contains to D:\Backup. I have tried with many xcopy commands but without result. Thanks.
I launched the command prompt with /k and saw this
which made me think there is a problem with the font. I installed new font that should fix this (YGP_NT) but I am having the same problem (yes, I changed it from the cmd Properties, edited the TrueTypeFont with regedit and restarted the PC). I can write in cyrillic in the cmd if that can help.
xcopy "%userprofile%\Desktop\Документи" "D:\Backup\" /s/h/e/k/f/c
should work, assuming that your language setting allows Cyrillic (or you use Unicode fonts in the console).
For reference about the arguments: http://ss64.com/nt/xcopy.html
xcopy e:\source_folder f:\destination_folder /e /i /h
The /h is just in case there are hidden files. The /i creates a destination folder if there are muliple source files.
xcopy "C:\Documents and Settings\user\Desktop\Документи" "D:\Backup" /s /e /y /i
Probably the problem is the space.Try with quotes.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I can use the variable %CD% to run a command-line virus scanner to scan the current directory from command prompt like this.
C:\AVPTool\AVPTool.exe SCAN %CD% /R:KAVSCANLOG.txt
I'd like use it from context menu to easily scan the folder with just two clicks.
I modified the registry and created a key called Scan with AVPTool in HKEY_CLASSES_ROOT\Directory\shell and within that key I created another key called command and changed the value to
"cmd.exe /k cd %1 & C:\AVPTool\AVPTool.exe SCAN %CD% /R:KAVSCANLOG.txt"
But this doesn't work since %CD% doesn't get translated into the current working directory.
I'd try
"cmd.exe /k cd %1 & C:\AVPTool\AVPTool.exe SCAN "%1" /R:KAVSCANLOG.txt"
since the line would be processed by replacing the %-variables and THEN executed, %CD% would be replaced by whatever the current directory of the INVOKING process is, not the directory in which the process is RUN. The current directory is only changed AFTER the cd has been executed, and by that time, %CD% has already been installed into the command - as it stood when the cmd.exe was invoked.
How can I change folder permissions on Windows using InstallAnywhere?
Since nobody answered yet, I found a possible solution.
On Install menu, click on Add Action... | Execute Command.
Fill the Command Line field with:
takeown /r /d y /f "\my_folder\*"
Add another Execute Command Action with:
icacls "\my_folder" /t /grant Everyone:F
Anybody found a easier way to do that?
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to grant permission to users for a directory using command line in Windows?
I want to grant all users of a system the permissions of read, write and modify for a folder.
I think there would be a command line that I use to do that, but if there is nothing and I have to write a code for it please help me with it.
Main Problem is that I want to grant these permissions to all users, usually I don't care about UserNames and I want to put "*" instead of usernames, to apply new permissions for all users.
any idea?
Thanks.
There is a command line - CACLS.
For example, to add "Everyone" with "Full Control" to the folder c:\temp\test you would use:
REM /t means "apply change recursively"
REM /e means "edit existing DACL".
REM Omitting this will overwrite the existing DACL.
cacls c:\temp\Test /t /e /g Everyone:f