Hello!
In a terminal server environment (Windows server 2008 R2) - I want to replace all instances of internet shortcuts for chrome, firefox and IE with custom one's I've created that force opening in incognito or private mode.
So, I need a bat file (or command line) that will scour the users folder and replace all examples of, e.g. "Google Chrome.lnk" with "Google Chrome P.lnk" - the latter being the one I customized with the -incognito parameter.
My intent is to have it replace all desktop shortcuts as well as the pinned shortcuts on the taskbar and start menu. I realize if someone wanted to open a non-private instance, they still could.
Thanks in advance - another forum posted a script here but I couldn't get it to work correctly
http://www.techpowerup.com/forums/threa ... es.146231/
PS - I'm an advanced computer user but NOT a programmer :>)
BAT file/Script to find and replace files
Moderator: DosItHelp
Re: BAT file/Script to find and replace files
What are the names of the .lnk files that you want to replace?
-
- Posts: 2
- Joined: 29 May 2014 12:12
Re: BAT file/Script to find and replace files
Google Chrome.lnk
Mozilla Firefox.lnk
Internet Explorer.lnk
I can always substitute or add additional links if need be as long as i have the framework
I haven't named the new links yet, but, they could actually be the same name.
Mozilla Firefox.lnk
Internet Explorer.lnk
I can always substitute or add additional links if need be as long as i have the framework
I haven't named the new links yet, but, they could actually be the same name.
Re: BAT file/Script to find and replace files
This may work - it's untested.
It searches for the .lnk files under c:\users and replaces them with "new link?.lnk" from the same folder as the batch file.
It searches for the .lnk files under c:\users and replaces them with "new link?.lnk" from the same folder as the batch file.
Code: Select all
@echo off
for /r "c:\users" %%a in ("Google Chrome*.lnk") do copy "new linkA.lnk" "%%a"
for /r "c:\users" %%a in ("Mozilla Firefox*.lnk") do copy "new linkB.lnk" "%%a"
for /r "c:\users" %%a in ("Internet Explorer*.lnk") do copy "new linkC.lnk" "%%a"