Fix "Unable to Find Package" NuGet Error in Visual Studio C#
Suppose you are in the command line, or PowerShell, or terminal, or you have created a script where you have to open Google Chrome in privacy mode where no search history is saved and no user-protected sensitive information is captured, then you have to use Google Chrome Incognito mode or InPrivate mode features. Let's have a peek at the process for using google chrome incognito mode in the command line or Powershell.
First, let's go over some of the terms associated with the Incognito mode of Google Chrome, and then we'll go over how to launch Google Chrome in Incognito mode or in private mode using cmd or Powershell.
The Chrome browser has a very helpful feature and settings called Incognito Mode, which prevents the browser from keeping a record of the websites that you visit. As an example, it does not maintain a record of previous search terms or other browsing data, cookies, or temporary files.
Cookies and temporary files, as well as search history and passwords, are deleted together with the session data from each anonymous browsing session. This ensures the protection of all potentially sensitive information.
You can force the browser to open in incognito mode by using a special argument called -incognito, which is found in the command line of the Windows operating system, Mac as well as Linux.
We may accomplish this by using the -incognito parameter in the command line, as seen below.
Open Command Prompt and type below:
start chrome -incognito
This will open chrome incognito in a new browser window with a default search engine.
If you have a default search engine is bing, then the incognito mode will open with bing.
If you have a default search engine is google search, then the incognito mode will open with a google search.
If you want to open a particular website in incognito mode then you can do as follows.
syntax:
start chrome URL -incognito
Example:
start chrome https://stackoverflow.com -incognito
This will open the StackOverflow website in chrome incognito mode.
The steps are as follows:
1 For this you have to go to the location where you have installed chrome.
2 Goto URL and type: cmd and press Enter.
This will open the command prompt where the Chrome installation location is.
3 Then type:
chrome.exe -incognito
If you want to open a particular website then the syntax is:
chrome.exe url -incognito
Powershell is a command line shell, a scripting language, and a configuration management framework. It is a cross-platform solution for task automation and configuration management.
If you want to use it in Powershell then you can use the below command.
Method 1: Using Start Command
This method is similar to what we did in the command line and also works in Powershell.
start chrome --incognito
Method 2: Using System.Diagnostics.Process
System.Diagnostics.Process gives you access to both local and remote processes and gives you the ability to start and terminate processes that are local to your system. And Start in above command starts a process called chrome.exe in the private browsing mode ie. incognito mode.
Run the below script in Powershell
[System.Diagnostics.Process]::Start("chrome.exe","--incognito $url")
A bat file is a specific kind of text file that is used by operating systems based on Windows. Within a bat file, you can write many commands that run in sequence, line by line.
Lets look how to do it.
First create a text file and then paste below command.
set url=ourtechroom.com
start "" /max chrome --incognito %url%
then save it with the.bat file extension like incognitomode.bat .When you double-click the bat file, ourtechroom.com will open in Chrome incognito mode.
or you can use below code as well.
set url=ourtechroom.com
start chrome --start-maximized --incognito %url%
google-chrome --incognito
If you are using MacOS with the Chrome browser, and want to open it through terminal, enter the following command in terminal.
open -a "Google Chrome" --args --incognito "https://ourtechroom.com"
This will launch Google Chrome in incognito mode with ourtechroom.com.
If you want to learn more, the last option is man open.