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).
Related
Is there a way I can save current split panel layout and profile for each panel so I don't need to split and open profile one by one again?
This feature does not yet exist as part of Windows Terminal.
However, this feature was suggested, and the suggestion has been accepted and is being tracked in the Windows Terminal github issues backlog:
https://github.com/microsoft/terminal/issues/3759
Work-around:
You can call windows terminal (wt) from the command line and specify starting directories, splits, tabs, profiles, etc.
For example, run this from command line and it will open up 2 Windows Terminal tabs, the first tab will be a split layout with PowerShell profile + your default profile, and the other tab will use the Ubuntu WSL profile:
wt -d "C:\Windows\System32" -p "PowerShell"; sp -V -d "%USERPROFILE%"; nt -p "Ubuntu" --title "wsl" --tabColor "#FF0000"
Better yet, set this command as the file location for a shortcut on your desktop and you can just double click the shortcut to open your favorite Windows Terminal configuration.
See more wt command line options here:
https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows
I downloaded Cmder on my PC but I want that the cmd starts on a folder as then I can navigate because if not the cmd starts in the Cmder folder and I can't go anywhere. Can someone help me, please? Wish you understood me!
Very simple and best way to get CMDER wherever you want is adding it to de Windows Context Menu (right click).
Open a terminal as an Administrator
Navigate to the directory you have placed Cmder
Execute .\cmder.exe /REGISTER ALL
If you get a message "Access Denied" ensure you are executing the command in an Administrator prompt.
In a file explorer window right click in or on a directory to see "Cmder Here" in the context menu.
From: https://github.com/cmderdev/cmder#shortcut-to-open-cmder-in-a-chosen-folder
Tip: put the CMDER files in c:\Program Files\CMDER
If I understood you correctly, you want to change the directory you start from each time you open a new terminal.
To do that:
click Win+Alt+t to open the settings
In the settings group 'Startup' choose 'Tasks'
Choose the console you want to modify (e.g. cmd::Cmder, cmd::Cmder as Admin, etc..)
Click the 'Startup dir...' button
Select the directory you want the console to startup in by default
Enjoy!
You dont give us much to go on but you should have a shortcut with which to start cmder perhaps on your desktop something like this.
If not find your installed copy of cmder.exe then Right Click it then select Send To
and then finally select "Desktop (as shortcut)"
Right click the shortcut and select Properties of that shortcut and then add your prefered starting DIRectory after a /start DIRective
If you want to Autorun other start-up commands see
https://stackoverflow.com/a/68185482/10802527
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
I try to launch a self written autoit application called "KeyShortcuts.exe" using a batch called "launchMacros.bat". This applications provides keyboard shortcuts for various things and includes a GUI which shows me the available shortcuts.
launchMacros.bat:
start "MyMacros" "M:\applications\AutoIt\KeyShortcuts.exe"
The application does start and I'm able to use every shortcut but I'm not able to see the GUI.
If I start the application direct (double click on KeyShortcuts.exe) everythings works fine.
I also tryed starting the application using runas:
runas /user:REQUIREDUSERNAME /savecred "M:\applications\AutoIt\KeyShortcuts.exe"
Same problem here. Even right click -> "Run as administrator" doesnt worked.
Any suggestions?
If your batch file is in a different directory than KeyShortcuts.exe, you may need to specify the starting directory using the /D parameter for START.
Like this:
START "MyMacros" /D "M:\applications\AutoIt" "M:\applications\AutoIt\KeyShortcuts.exe"
Every batch file launched from Windows GUI create a new console window, run the batch file, then close. If you need this to be different, there's several ways:
Create a shortcut to CMD /K YOURBATCHFILE.BAT
Add a pause to your BAT file
Here's a demonstration of method 1:
New > Shortcut
Type the location of the item: C:\Windows\System32\CMD.EXE
Type the name for this shortcut: InsertYourNameHere
Click Finish
Right click on your Shortcut and go properties
Change Target to: C:\Windows\System32\CMD.EXE /K "InsertYourBatchFileName.BAT"
Click OK
Done, now you have a shortcut that opens a new console window and leaves it open whilst ir runs your batch file.
After installing the new server, I am facing an issue.
I have lot of .vbs files, all need to run in wscript, reason, I use all those command like WScript.Echo "hello"
I want to be able to see the output when I double click the VBScript file.
But when I right click on the vbs file, I see console, I want to change the default to Windows host, globally!
How can I do that?
You can change the default scripting host to wscript.exe like so:
wscript.exe //H:wscript
If you wish to set cscript as the default host, that works in the same way:
wscript.exe //H:cscript
You can execute cscript.exe with the same arguments for the same result.
You can switch the default script engine with:
wscript //H:Wscript
Good luck!
I was able to solve it by using the following steps:
selecting the VBScript file that I want to open,
right click to select default program for this,
browse to C:/windows/windows32/wscript.exe, and select this.
In command prompt (as administrator):
To set windows script host as default script host enter:
wscript.exe //H:WScript
To set command line based script host as default script host enter:
cscript.exe //H:cscript
Check the Windows Explorer settings for the filetype *.vbs (something like tools->options->file types etc.) and change the "open with" setting to cscript.
Edit: I now advise caution with the recommendations I give below. After continuing to toggle and test my settings, I find I am unable to re-establish cscript as my default script host. (Note that I also retried the procedures given by other answers to this question.)
In addition, I tried using Process Monitor (a.k.a., "ProcMon") to find the reason for my difficulties, but unfortunately have not been unsuccessful.
Finally, I also considered going back to an earlier Windows 7 restore point, but this was complicated by the fact that I just yesterday changed my domain password. So, for now, I'm going to have to put my investigation to rest as other tasks are pressing.
On last thought...I have also considered the possibility that there are network policy security settings that are thwarting my efforts.
Original Answer: Enter the following line in a Windows batch file:
ftype VBSFile="%%SystemRoot%%\System32\WScript.exe" "%%1" %%*
Then, run a Command Prompt as an Administrator and run the batch file.
I believe the above will make the change for all users on the system. To make the change for only the logged in user, do the following (on Windows 7):
Control Panel => Programs => Default Programs => Associate a file type or protocol with a program
Then, in the Name column, scroll down to .vbs and click Change program... in the upper right. Then choose one of the Recommended Programs. If you do not see Microsoft ® Windows Based Script Host, browse to the following file:
C:\Windows\System32\wscript.exe
The guy above who right-clicked to choose the default program was right, however the path should be: C:\Windows\System32\wscript.exe