01-06-2012
10,
0
Join Date: Dec 2011
Last Activity: 6 January 2012, 12:10 AM EST
Posts: 10
Thanks Given: 1
Thanked 0 Times in 0 Posts
Problem while working with multiple files
Dear friends,
I am working with two files named g1.txt and g2.txt....g1.txt is my main file in which it contains following data
#per_no permissionname permission command
1|HideCDrive, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDrives /t REG_DWORD /d 4 /f ,
2|HideRunButton, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f ,
3|DisableControlPanel, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v NoDispCPL /t REG_DWORD /d 1 /f ,
4|AddMycomputerIexploreandMynetworkplaceMyDocumentIcononDesktop, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explore\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f ,
5|RestrictUserToRuncmd, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v DisallowRun /t REG_DWORD /d 1 /f ,
6|RemoveAdd/RemoveProgramsprograms, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Uninstall" /v NoAddRemovePrograms /t REG_DWORD /d1 /f ,
I have another file say g2.txt in that some of the data fetched from g1.txt and content of that file look like this.
HideCDrive,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDrives /t REG_DWORD /d 4 /f ,
HideRunButton,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f ,
DisableControlPanel,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v NoDispCPL /t REG_DWORD /d 1 /f ,
AddMycomputerIexploreandMynetworkplaceMyDocumentIcononDesktop,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explore\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f ,
RestrictUserToRuncmd,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v DisallowRun /t REG_DWORD /d 1 /f ,
RemoveAdd/RemoveProgramsprograms,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Uninstall" /v NoAddRemovePrograms /t REG_DWORD /d1 /f ,
I want to create a script in which user enters permission numbers say 1,2,3 ....it will take permission number one by one say 1 ,then it will take the respective permission command grom g1.txt file....i.e "REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDrives /t REG_DWORD /d 4 /f , " .....i want to check that this permission command is exist in g2.txt file or not. If it exist then delete that permission name as well as permission command....
at this time my g2.txt file look like this.
HideRunButton,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f ,
DisableControlPanel,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v NoDispCPL /t REG_DWORD /d 1 /f ,
AddMycomputerIexploreandMynetworkplaceMyDocumentIcononDesktop,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explore\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f ,
RestrictUserToRuncmd,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v DisallowRun /t REG_DWORD /d 1 /f ,
RemoveAdd/RemoveProgramsprograms,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Uninstall" /v NoAddRemovePrograms /t REG_DWORD /d1 /f ,
#-----------------------------------------------------------------------------------------
How can i do that? Any help would be appreciated....