I work for a charity that refurbishes PC and Laptops that are then given to children who can't afford them.
One of the things we would like to do is add a desktop icon after we install windows that will open Childlines webpage using chrome
but in incongnito
mode. I remember writing batch script years ago but I am assuming we have moved on somewhat.
What is the best way to do this?
CodePudding user response:
You can create a temp vbs
file to do this, launch it and delete the temp vbs
file:
(
echo Set oWS = WScript.CreateObject("WScript.Shell"^)
echo sLinkFile = "C:\users\public\Desktop\Childline.lnk"
echo Set oLink = oWS.CreateShortcut(sLinkFile^)
echo oLink.TargetPath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
echo oLink.Arguments = "-incognito http://sitenamehere.com"
echo oLink.Save
)>create_short.vbs
cscript create_short.vbs
Just update the browser path and website details. Also look at which user profile you need to update. The above focuses on public
CodePudding user response:
If you wanted to do this with a batch script without creating a vbs file, you could also utilize powershell like the following one liner:
if not exist "%userprofile%\Desktop\Chome_Incognito.lnk" %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe /command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%userprofile%\Desktop\Chome_Incognito.lnk');$s.TargetPath='%programfiles%\Google\Chrome\Application\chrome.exe';$s.Arguments=' -incognito http://sitenamehere.com';$s.Save()"
This creates the shortcut on the %userprofile% desktop and points to the Program Files location for Chrome. Adjust that and the sitename URL as needed.