This works (Notepad++):
C:\Anywhere> start notepad++ hello.txt
And this works (SoX for removing silence in sounds):
C:\Anywhere> sox in.wav out1.wav silence 1 0.1 1%
Yet, my PATH variable includes neither (would send on request).
How can I do this with my program?
To run from everywhere.
Also, why doesn't Notepad++ work without the start command?
(I did this workaround by putting the .exe in C:\ and then simply calling C:\Anywhere> /myprogram but I'm still curious about the above.)
To get the indicated scenario where
you can start applications from anywhere using the start command (or the windows Run dialog) without including its parent folder in path variable,
but you can not start the application without the start command from any directory whithout including the full path to reach it (it is not in the path) or being located in the adecuated directory
the applications are included in the registry under the key
HKEY_CLASSES_ROOT\Applications
note: It is a "merged" view showing the combined contents of
HKEY_LOCAL_MACHINE\Software\Classes\Applications
HKEY_CURRENT_USER\Software\Classes\Applications
If you are not administrator to change the local machine configuration, you can always modify your user registry information to include the applications you need.
edited There is a second place in registry that will allow to include an application in the registry to be executed using start command, Run dialog or from anything that uses the ShellExecute or ShellExecuteEx API calls.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
Related
I'm curious why commands like "start iexplore" and "start firefox" work in Windows cmd.
They're not standalone commands. If you try to type in just "firefox", you'll get:
"'firefox' is not recognized as an internal or external command,
operable program or batch file."
This leads to the conclusion that this is a special behaviour of the "start" command.
My first guess was that it works in a similar way to how the %path% variable is used, having known directories to search in.
I ruled it out easily by trying to run "start [executable]" for another executable located in the same directory as firefox.
My conclusion is that somewhere on my computer there's a list of designated file paths, that can be started by simply typing their file name after the "start" command, instead of the entire path.
Imagine the potential of being able to add things to this list..
Anyone knows where I can find it?
It is in the registry
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
Under this key there are defined applications that can be invoked without need to change the path environment variable.
Usual invocation (typing the name in the command line) will not search inside this list, but call to start command, windows Run dialog or call from anything that uses the ShellExecute or ShellExecuteEx API calls, will check for applications defined in this list.
I want to run a command that is installed and available globally on my cmd.exe commandline.
This usually works fine, except when I run it in a directory that has a file with the same name as the command.
So any time I use this command in this particular directory my windows is trying to open this file in whatever application is registered for this extension.
It is very annoying, but there must be a way around this right?
I tried it with a bunch of names, like ping.txt and they all open the files intead of running the command.
That's not normal behaviour in the default configuration; sounds like the PATHEXT environment variable has been modified.
You could either change it back to the default,
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
or explicitly type ping.exe (for example) instead of just ping.
If the file name is EXACTLY the same (including the same extension, i.e. ".exe"), then I believe the only way around this is to specify the full path to the file you WANT to execute. For example, if the program you want to execute is explorer.exe, but you have a file named explorer.exe in your current directory, you have to specify \Windows\explorer.exe to run Windows explorer.
Say I've got a windows batch file with a file extension .batscript, and say I've got a web server set up to serve it with a content-type of application/x-batscript. How can I set up Firefox 4 to "always open" this file so that it runs as a standard batch file would? (I have access to the PCs but want avoid creating/installing external programs/extensions/plugins)
I can't use a straight .bat because Firefox doesn't allow those to be opened directly; they have to be saved and run separately (for obvious security reasons).
The standard way to run a batch file is cmd /c %1 where %1 is the path to the bat file, but this doesn't work when %1 is a path to a file with a custom file extension (such as .batscript) because cmd looks up what application %1 should be opened with, so adding a direct file association via the registry doesn't work (it recursively opens cmd prompts).
Instead, I found a work around where I temporarily copy my .batscript file to a .bat file and run it, using registry entries like this, which allows me to double click on a .batscript file to run it. But Firefox doesn't respect these platform file associations!
Ok, so Firefox wants me to define my file type associations separately for each content-type: fair enough, file extensions & content-types aren't always the same. But I can only get Firefox to run discrete applications, and a batch script needs to be run with cmd.exe /c %1 not just cmd %1.
Does anybody know of a way to force Firefox to either use the system file association or allow launching arbitrary programs with command line parameters?
(For those wondering, the use case is similar to "an internal web app which allows users to run a local program with a varying amount of command line parameters by clicking on a link" - alternative solutions to these small "breaking out of the sandbox" problems are also welcome!)
I think you need to edit the MimeTypes.rdf file. For more information see also this page.
I want to set an alias to my installation of firefox so I can easily start a web page, the problem is that I dont want the script to be system dependent.
Namely I want it to be able to run on a linux distribution where the command to start firefox is already mapped to 'firefox' and can easily be run that way through bash, but on my windows machine I cant seem to get it to assign to the same variable.
I saw that I could set it to '%firefox%' via the set command but that's not quite what I want.
I believe creating aliases is possible on a windows environment because the version of svn that I use auto-installed and was able to assign itself to 'svn'. Anyone know what was involved in them being able to get their alias working, or a similar way to alias a command?
If you include your Firefox path in the %PATH% environment variable, you can start FF with "firefox". Under Windows, you should edit the system-wide settings (see this link).
AFAIK, there is nothing similar to aliases under DOS/Windows (except the %firefox% way you mentioned, too). The 'svn' command you talked about most likely is the same thing, a 'svn.exe' and its path included to %PATH%.
This is a bit restrictive, as you can only use the original filename to launch a program, but you can work around this by creating a batch file in the program's path that launches the program, f.e. a FF.BAT that contains "firefox %1".
Alternatively, you can place a batch file in a path that already is in %PATH%, f.e. the Windows directory. That way, you don't have to modify %PATH%.
Does anyone know how you setup new commands to launch an application from the Start->Run box?
ie. you can type "firefox", "winword" or "excel" into the Run box and those applications will open even though they're not in the system path, but others won't. For example, with Firefox, there's no files named firefox.* in any of my system path directories:
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Subversion\bin;c:\Program Files\Microsoft
SQL Server\90\Tools\binn\
So there must be some way of linking applications with this path to create a shortcut command, maybe in the registry?
For example, I want to be able to launch Google Talk from the Run command, but typing the executable's name "googletalk.exe" doesn't do anything, which makes sense because it's not in the system path, but neither is firefox.exe, and typing "firefox" works.
Does anyone have any ideas?
From http://commandwindows.com/runline.htm:
Adding applications to the Path
Alternatively, the Registry can be
edited to explicitly contain the path
to the desired executable file or
files. The Registry key involved
isHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App
Paths
Create a new sub-key with the name of the executable file that you
wish to add to the path. e .g.,
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App
Paths\somefile.exe
In this new key, add a string variable named "Path" containing the
value of the the path to your new
executable file, e.g., C:\Program
files\newprogramfolder\
The new key will already have an empty variable (Default). Edit it to
have the string value of entire
address of the new program executable , e.g., C:\Program files\newprogramfolder\somefile.exe
3 steps.
Create a shortcut to the foo.exe you want to run (foo.lnk)
Copy the foo.lnk to your C:\windows directory.
Run foo.exe by simply typing "foo" in your run dialog. ("start foo" in cmd prompt works too)
You could also use an application launcher like Launchy, Slickrun or Executor. That way you wouldn't have to mess with the registry. I use Executor and I can just select "send to -> executor" to create a shortcut for any app (or folder or whatever).
Run works with search paths, which include the Path environment variable and some others. There might be more information in the MSDN, give me a moment and I'll look it up.
I put a link to the application I want to launch in the "c:\windows" folder, and I use it all the time. You can also rename the link file, of course, to speed up things: for example, I type w, x or pp to launc Word, eXcel or PowerPoint.