launching putty from browser also opens up cmd.exe - html

I was trying to launch PUTTY from web browser while, I was able to achieve this after reading this post " http://johnsofteng.wordpress.com/2009/05/12/launch-putty-from-browser/ " but when i click on any ssh:// link both command prompt(cmd.exe) and putty.exe are opening up.I do not want command prompt(cmd.exe) to openup instead only putty.exe should launch.

The command window runs you batch file, you can achieve what you want with the following:
add start (https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true) to the batch file call to start putty, ie:
start /b "C:\Program Files\PuTTY\putty.exe" %extract%
this allows the batch file to close once putty has launched, rather than waiting for it to exit.
To prevent the command window appearing in the first place take a look at this answer https://superuser.com/a/443181 and the thread it is in in general

Use this:
CD C:\Program Files\PuTTY
start putty.exe %extract%
exit
instead of :
"C:\Program Files\PUTTY\putty.exe" %extract% exit

Related

How would I make batch code running in a command prompt window unclosable?

I'm looking to make a file that when running it constantly kills chrome so you cannot run it (this is just for fun) and I'm trying to make it so it is not possible to just close it by hitting the X button
Would it be possible?
cls
:kill
taskkill /IM chrome.exe
goto kill
Well Windows command prompt don't let you do that.
However another languages like Python can do that.

how turn off browser sync in sublime text 3?

I'm using Sublime Text 3 and installed browsersync package for live reloading.
When I quit from Sublime and close liveserver app in my browser and try to open new liveserver with react start command I get a message that say: "Something is already running on port 3000." Then I check localhost:3000 and the browser still sync to Sublime I don't know how to turn off liveserver in port 3000 ?
please help me
I assume that this is the plugin you're using. Unfortunately, the plugin has been abandoned for 5 years, and the way it's written, there is no method for killing the node server once you're done with the plugin. From the Windows command line, this:
taskkill /im node-windows.exe /f /t
should do the trick, but you'll have to run it manually. Alternatively, you can use Task Manager to kill any node-windows.exe processes.
Another way to kill the service is going to
Start -> Resource Monitor -> Network
Under "Listening Ports" check for your port number, in this case 3000.
Take the process Id and then look for it under "Processes with Network Activity"
Check the process and right click -> End Process.
This will end the process utilizing the port 3000.
Try using Ctrl+C on your keyboard in your terminal or your command line (depending on whether your operating system is Unix based or Windows based). PowerShell should work too, if on a PC.

How to start new process in terminal without kill the one which still running

ex. when i open google-chrome through terminal i can't write command lines anymore, is there a way to start new command line in same terminal window without closing chrome ?
use the & to put the process in the background. e.g.:
open google-chrome &
Or just open another terminal window and run your command

CMD runs EXE, launches HTML, wait until close and run final EXE

would like have BAT file that runs set-keys.EXE, launches default.html, and then when user closes html, run set-keys-back.EXE. (they are all in the same directory together). This might be run from a CD, so I might not have ability to write a flag file and then wait to see if it is deleted in order to continue. Have already tried START /WAIT but have seen that WAIT won't actually wait for GUI 32-bit applications. Have considered one batch file calling another one, still no luck. Would prefer not to have PAUSE and user have to come back to CMD just to hit a key - seems clunky. When they close out of HTML, I execute top.window.close(). would be nice if I could put some other code after that, but I think once the window is closed it's closed - no more processing. have not been able to get WShell execute to run. HTML status bar just says error on page - no info. Would love to hear your thoughts...
Update 2: I just figured out that you can launch IE directly without having to use the start command:
#echo off
rem You can use %SCRIPTDIR% to refer to the file to load, if you like
rem Note that %SCRIPTDIR% will contain a trailing slash!
set SCRIPTDIR=%~dp0
echo Testing this script...
C:\PROGRA~1\INTERN~1\iexplore.exe %SCRIPTDIR%foo.html
echo Continuing the script...
This example works for me (Windows XP 32-bit), and waits for me to close the browser window to continue.
Update: Here's an updated code block that launches Internet Explorer. Note that I use the short path to the iexplore.exe executable, and I specify the full path to the file to load:
#echo off
echo Testing this script...
start /wait /min cmd /C "C:\PROGRA~1\INTERN~1\iexplore.exe C:\foo.html"
echo Continuing the script...
Initial Answer: You mentioned trying the start /wait command, but how did you explicitly write it? The following batch script example works for me in Windows 7 x64:
#echo off
echo Testing this script...
start /wait /min cmd /C "%windir%\system32\notepad.exe foo.html"
echo Continuing the script...
In this example, the script does not continue execution until the user closes the Notepad application. The only downside here is that an extra command window pops up, but by using the /min parameter, we can start it minimized.

Windows: How to open a .exe in a shell window that won't close?

I've had this problem for ages, and it's SO ANNOYING.
Suppose I want to run mysqldump.exe... here's my process: Start->run, type "cmd" ... dir into directory after directory until I finally get to c:/program files/mysql/bin/then I can FINALLY call "mysqldump.exe"
I don't mind using Windows Explorer to get to c:/program files/mysql/bin, but then I can't freaking open up any of the .exe files in a shell, and I can't open up shell with the directory being that one.
How can I do this?
This is what I do for those type of commands:
Drag a copy of the "Command Prompt" shortcut onto your desktop.
Open the properties of the shortcut.
Change the Target: field to: %SystemRoot%\system32\cmd.exe /k mysqldump.exe
Change the Start in: field to: c:/program files/mysql/bin/
Hit Ok, then rename the short cut from "Command Prompt" to "Mysqldump".
Then just double click the icon whenever you need that command. The "/k" option for cmd.exe leaves the window open.
Microsoft released a powertoy for Windows XP called Open Command Prompt Here. If you're using Vista, all you need to do is hold shift and right-click.
here's my process: Start->run, type
"cmd" ... dir into directory after
directory until I finally get to
c:/program files/mysql/bin/ then I can
FINALLY call "mysqldump.exe"
Why not just the following?
c:
cd "c:/program files/mysql/bin"
mysqldump.exe
Better yet, put this in a batch file and execute it.
You can also create a shortcut for cmd.exe and set the "Start in" directory to "c:/program files/mysql/bin".
You can download an add-in so that you can right click on the folder and open a command prompt. Saves a lot of time and you say you dont mind navigating to the location.
http://download.microsoft.com/download/whistler/Install/2/WXP/EN-US/CmdHerePowertoySetup.exe
A nice little trick is that the icon in the adress bar of explorer could be dragged to a command line window and it insert the full path at your current cursor position.
It doesn't work in vista but if you SHIFT-RightClick on a folder you have an "Open Command Windows Here" option that appears.
Under xp you could have it by saving this as a .reg and executing it :
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd]
#="Open Command Prompt Here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd\command]
#="cmd.exe /k pushd %L"
Just use the explorer to navigate to the bin or any directory. then enter cmd at the address bar und hit return. the command line with start at this location.
You can do it with python:
If you don't have activepython already, download from ActiveState's Website. Next, run PythonWin and create a new script. Write the following:
from subprocess import *
Call("c://program files//mysql//bin//mysqldump.exe")
Save the script somewhere. When you want to run it, just doubleclick. There are easier ways if you like writing batch files, but Python is more succinct than even windows for this case.
Just put c:/program files/mysql/bin/ into your path...
Then you can run mysqldump.exe directly without even opening a cmd prompt by typing it into " Start > Run "
I was using the MS PowerToy for a while but moved on to the open source Open Command Prompt Shell Extension because of the key feature:
(copied verbatim from the website)
The ability to open a command prompt in the directory that you are currently in by right-clicking on any empty screen space in the directory. This eliminates the need to navigate up a level in order to open a command prompt in the current directory.
Having to actually click on a folder to open the command prompt using the MS tool was a annoyance for me... especially since I always need to run command line tools on my current directory at the time.