Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Windows 7 Batch script help?

Posted on 2014-07-24
12
Medium Priority
?
851 Views
Last Modified: 2014-07-31
Can someone help me try to make a batch/.cmd that does the following?

1. Deletes all items in this folder:
C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

2. Deletes this folder:
C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

3. Deletes the line "[LocalizedFileNames]" and everything below it, from the file:
C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Desktop.ini.

Typically this .ini will contain a section in the desktop.ini that contains "[LocalizedFileNames]" and then a line or two below it that has "Internet Explorer.lnk" lines, trying to get those deleted.

4. Delete "StubPath" and "LocalizedName" from the key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{89820200-ECBD-11cf-8B85-00AA005B4383}", or any item in this key that contains the value "@C:\Windows\System32\ie4uinit.exe,-2000" and/or "C:\Windows\System32\ie4uinit.exe -BaseSettings"


The first 2 I think I can do with the del command but I'm having trouble with 3 and 4. Not sure if it can be done in a reg script or just exported as reg and imported...


The overall goal of this is to Remove Internet Explorer Pinned and Start menu shortcuts for All Users and new-users, because it doesn't appear to be possible with Group Policy. These are the areas I found to resolve it
0
Comment
Question by:garryshape
  • 7
  • 5
12 Comments
 
LVL 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 2000 total points
ID: 40218156
For the 3rd one: can you provide a sample of that Desktop.ini file and what you want removed?

One and two can be done with one rmdir command:
rmdir /s /q "C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"

Open in new window

And number 4: would be easiest to just delete that {898... } key first and then load the key abain with default values, that way you don't have to search for 'any item'.

You delete that key by putting this in a .reg file:
Windows Registry Editor Version 5.00

[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{89820200-ECBD-11cf-8B85-00AA005B4383}]

Open in new window

and calling that with: regedit /s delete_key.reg

To create the default .reg file, edit the registry the way you want it to look, export it as default_values.reg and import it: regedit /s default_values.reg
0
 

Author Comment

by:garryshape
ID: 40218165
Ahhh ok got it, yeah let me try it!
Here's the INI file


[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21782
[LocalizedFileNames]
Internet Explorer.lnk=@%windir%\System32\ie4uinit.exe,-734
Internet Explorer (64-bit).lnk=@%windir%\System32\ie4uinit.exe,-735



So deleteing the parts bold'd would be the goal.
Then again wondering if like you said, it'd just be easier to delete the file then copy over one without the information.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40218206
>> Then again wondering if like you said, it'd just be easier to delete the file then copy over one without the information.
If you have or can create a default file: yes do that. It's the easiest, like re-creating the default reg key.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:garryshape
ID: 40219573
Well the problem is now I can't edit the "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\desktop.ini" file.

If I try from a command I get permission denied. If I try to overwrite with another one with xcopy, also Access denied.

I tried running "attrib -S _H" against the desktop.ini file and I still get Access denied

Or if I try to copy another desktop.ini to overwrite this desktop.ini, I get "access denied".
I can't delete it either at least from a command prompt. I have full access but "System" is the owner
0
 

Author Comment

by:garryshape
ID: 40219998
Ah ok here we go, I think this will work so far no errors. I had to change -S and -H to -s -h (lower case):

cmd /c attrib -h -s "C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\desktop.ini"
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40220550
Ok, were you able to copy the default desktop.ini file?
0
 

Author Comment

by:garryshape
ID: 40227750
Well at this point, there's still a blank icon pinned to the task bar for Internet Explorer. Even though I delete the registry pointed, and the actual .lnk file in the DefaultUser folder, it still shows up for any new user that logs in.
To remove, I have to click the pinned shortcut, and click "yes" at the prompt to remove the invalid pinned shortcut.

So this makes me wonder, if I have to delete the .lnk first, reboot and then delete the registry, or vice versa, or if there's a special order of trying to get rid of it.

I had it removed for all new users at one point, just can't recall what else I did differently.
0
 

Author Comment

by:garryshape
ID: 40227871
Ok, I got rid of the icon by doing the following in addition to what I've done so far.
I loaded the hive of C:\Users\DefaultUser\NTUser.dat then deleted the key "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband".
Will that mess anything up?
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40229329
>> Will that mess anything up?
That is a good question, I wouldn't know for sure...
0
 

Author Comment

by:garryshape
ID: 40229352
It doesn't appear to. It just makes it to where the pinned items I removed originally via the Registry and File system do not appear. We don't want those icons being pinned anyways since we're using Citrix to alternatively deliver those applications.
It does appear I can pin things manually as the user, reboot, and they remain there.
I was reading up on the Taskband thing and apparently there's encryption throughout the registry where Microsoft interestingly uses rot 13 encryption and some administrators have gone to very complex measures to fine-tune and customize the pinned items and other user shortcuts.
0
 

Author Comment

by:garryshape
ID: 40230634
I'm going to accept the batch advice it really helps.
Just something I'm having to work with, which is tedious, is HP's moronic built-in OEM stuff. They have multiple xml files for sysprep so it keeps overriding stuff.. really crazy
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40232611
Thanks :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question