Open a file with a specific program using cmd - windows

I want to open a HTML file using cmd, located in the autostart folder using internet explorer, even tho for example Firefox is selected for standard browser.
I already navigated to the autostart folder.
How can I do that?
Or what is the command for that?

%ProgramFiles%\Internet Explorer\iexplore.exe" file://path_to_file
Refer to the command line options for IE11 for details of options that you might need

Related

How do I execute OneNote UWA from Windows command-line?

I can't figure out how to start the OneNote UWA from Windows command-line. The best I could do is find where it's installed. However, I don't know how to actually start it up from the command-line; as, the executables in that directory don't start OneNote UWA.
C:\Program Files\WindowsApps\Microsoft.Office.OneNote_16001.11901.20096.0_x64__8wekyb3d8bbwe
PS: I tried to use the same command-line that's in Windows TaskManager (below). However, the app doesn't startup nor does it give an error; even with elevated privileges.
"C:\Program Files\WindowsApps\Microsoft.Office.OneNote_16001.11901.20096.0_x64__8wekyb3d8bbwe\onenoteim.exe" -ServerName:microsoft.onenoteim.AppXxqb9ypsz6cs1w07e1pmjy4ww4dy9tpqr.mca
I'd really appreciate any help suggestions to do this. If this is not possible (or nobody knows the answer, I would also be happy if someone knows how to associate a global hotkey to OneNote UWA.
I followed this tutorial and it worked great for me:
Launch Metro app from command line
my resultant command was this:
explorer.exe shell:AppsFolder\Microsoft.Office.OneNote_8wekyb3d8bbwe!microsoft.onenoteim
which launched into OneNote (metro/winrt/uwa version and not the desktop version)
There is a shortcut you can do that would have worked in my case. When you look at the target of the shortcut you create... instead use this command line tool to get the full target (since you can't copy from the target box in the shortcut properties window) and then use this instead:
explorer.exe shell:<target value>
get the command line tool here:
LNK file parser
careful though because the value wraps when you use the LNK file parser in a command window. You can output the result text from lnk_parser_cmd to a text file to ensure you get the correct value. Their example is:
lnk_parser_cmd.exe shortcut.lnk
you would simply use:
lnk_parser_cmd.exe shortcut.lnk > result.txt
and then you can easily copy and paste the non-wrapped text from result.txt.

Can't find Cmder in program files

I've been having trouble finding the cmder inside windows program files. I wanted to make a shortcut to it so that I can easily access it using windows docker but can't find the location. I only have cmder now pinned on my taskbar but I would like to know it's directory path. Thanks in advance.
I am using windows x64bit
Open a command line window.
Enter "dir Cmder.exe /s"
It's relative to where you installed it. To find out right-click cmder in your taskbar, and you will see that it says "cmder.exe - shortcut", right-click it again and access properties. In the target field you will see your path.

Open chrome with cygwin

I am using a cygwin shell in windows 10. I am trying to figure out how to open chrome from the command line. I have tried typing chrome, google-chrome, chromium-browser, start chrome, open chrome, and many variations. I have even tried using my python shell, and I have also tried going to the folder where chrome.exe is located and opening it from there. The main reason I want to figure it out is because I plan to write HTML documents with python and then open them in chrome. Any ideas?
Did you try ./chrome.exe while being in the directory where the file is located? The path ./ is probably needed before the file name since the executable is not in a standard system path. You can of course also specify the full path to the file as well.
Use
cygstart "C:\path\to\chrome.exe"
or to open a specific URL,
cygstart "http://my/url.htm"

How to restore bat file execution from explorer on XP

some bat files need to be launched at the start of the session, but they don't.
Actually, when trying to launch one from the explorer, it opens the Open with window instead of just runnig.
However, the bat files still run correctly from the command prompt.
I bet it has been caused by a virus, but the antivirus did not detect anything unfortunately.
Any idea?
Use the Open With command, select cmd.exe, then before you hit OK, check the box that says "always use this program to open this type of file" or something similar.
If cmd.exe is not in the choices, browse to c:\windows\system32, and cmd.exe should be in there.
You can re associate the extension by downloading the reg file for batch from the link below which should solve your problem.
http://www.dougknox.com/xp/file_assoc.htm

Launching a website via windows commandline

I have a program launching a website via the following command.
cmd "start /max http://url.com"
When launching a website via this method it uses the default browser with its default settings for opening a new window. for example, Firefox and IE will open the window inside the tab of an existing window if they are set to do so. I have reports of IE 6 replacing the content of a current opened window with the content of url.com. I've tested this and sure enough when IE 6 is set as the default browser and with a current webpage opened the above will replace the content of the opened window with url.com rather than opening a fresh window.
Upon running some tests I see the command listed here:
cmd "start /max iexplore.exe http://url.com"
will consistently open a new window( with Internet Explorer of course) regardless of an existing window being present or not.
Can anyone tell me if I'm missing a silly setting in IE 6 or if there is a way to duplicate the "always open a new window" functionality exhibited by calling iexplore.exe directly, but with calling the user default browser instead.
You can just use
explorer "https://google.com"
Which will launch your default browser and navigate to that site.
And on Mac I've using
open "https://google.com"
To open a URL with the default browser, you can execute:
rundll32 url.dll,FileProtocolHandler https://www.google.com
I had issues with URL parameters with the other solutions. However, this one seemed to work correctly.
start chrome https://www.google.com/ or start firefox https://www.google.com/
This worked for me:
explorer <YOUR URL>
For example:
explorer "https://www.google.com/"
This will open https://www.google.com/ in your default browser.
IE has a setting, located in Tools / Internet options / Advanced / Browsing, called Reuse windows for launching shortcuts, which is checked by default. For IE versions that support tabbed browsing, this option is relevant only when tab browsing is turned off (in fact, IE9 Beta explicitly mentions this). However, since IE6 does not have tabbed browsing, this option does affect opening URLs through the shell (as in your example).
You can start web pages using command line in any browser typing this command
cd %your chrome directory%
start /max http://google.com
save it as bat and run it :)
Working from VaLo's answer:
cd %directory to browser%
%browser's name to main executable (firefox, chrome, opera, etc.)% https://www.google.com
start https://www.google.com doesn't seem to work (at least in my environment)
Ok, The Windows 10 BatchFile is done works just like I had hoped. First press the windows key and R. Type mmc and Enter. In File Add SnapIn>Got to a specific Website and add it to the list. Press OK in the tab, and on the left side console root menu double click your site. Once it opens Add it to favourites. That should place it in C:\Users\user\AppData\Roaming\Microsoft\StartMenu\Programs\Windows Administrative Tools. I made a shortcut of this to a folder on the desktop. Right click the Shortcut and view the properties. In the Shortcut tab of the Properties click advanced and check the Run as Administrator. The Start in Location is also on the Shortcuts Tab you can add that to your batch file if you need. The Batch I made is as follows
#echo off
title Manage SiteEnviro
color 0a
:Clock
cls
echo Date:%date% Time:%time%
pause
cls
c:\WINDOWS\System32\netstat
c:\WINDOWS\System32\netstat -an
goto Greeting
:Greeting
cls
echo Open ShellSite
pause
cls
goto Manage SiteEnviro
:Manage SiteEnviro
"C:\Users\user\AppData\Roaming\Microsoft\Start Menu\Programs\Administrative Tools\YourCustomSavedMMC.msc"
You need to make a shortcut when you save this as a bat file and in the properties>shortcuts>advanced enable administrator access, can also set a keybind there and change the icon if you like. I probably did not need :Clock. The netstat commands can change to setting a hosted network or anything you want including nothing. Can Canscade websites in 1 mmc console and have more than 1 favourite added into the batch file.
Using a CLI, the easiest way (cross-platform) I've found is to use the NPM package https://github.com/sindresorhus/open-cli
npm install --global open-cli
Installing it globally allows running something like open-cli https://unlyed.github.io/next-right-now/.
You can also install it locally (e.g: in a project) and run npx open-cli https://unlyed.github.io/next-right-now/
Or, using a NPM script (which is how I actually use it):
"doc:online": "open-cli https://unlyed.github.io/next-right-now/",
Running yarn doc:online will open the webpage, and this works on any platform (windows, mac, linux).

Resources