| 1. |
Solve : please need help with a batch file!? |
|
Answer» Hi! The directory name should be a variable that i could put in the parameter of the executed file...I'm not sure exactly what you mean, but if you put the following in a batch file I think this should do what you want: Code: [Select]for /f %%a in ('dir /b /ad') do (echo programmtochangerights -f -d user=%%a owner=administrator)This code ASSUMES that you want the "user=" line to be the directory name as in your example. If this is not what you wanted, please provide more details. I currently have it output what the command would actually be so you can check the output. To have it actually run the command, just take out the word "echo". This will process all directories from the directory the command is run in. Also note that if any of the directories have spaces in them, you may need to put quotes around the %%a ... but since I don't KNOW the program you are using this may not be supported or necessary.If you have a list of given directories then you can use: Code: [Select]set dirs=, set dirs=%dirs%"directory1", set dirs=%dirs%"directory2", set dirs=%dirs%"directory3", set dirs=%dirs%"directory4", set dirs=%dirs%"directory5", for %%a in (%dirs%) do programmtochangerights -f -d user=%%a owner=administrator Hope this helps |
|