If I create an .exe file with Visual Studio 2010 (in the bin/Debug folder) is it possible to use a bat file to start this program?
I tried the below in my bat file:
start "c:\Services\ServicesChecker\ServicesChecker\bin\Debug" ServicesChecker.exe
however when I run it, it says Windows cannot find ServicesChecker.exe even though if I browse to the location I can see it?
In your command, the "c:\Services\..." is the title given to the window, and is not used to find the executable.
Try:
start c:\Services\ServicesChecker\ServicesChecker\bin\Debug\ServicesChecker.exe
Its because there is no option in start by which you can specify the path.
Use
start "c:\Services\ServicesChecker\ServicesChecker\bin\Debug\ServicesChecker.exe"
this should work.
Try just using the file path rather than start, and you need to include the filename in the same quoted path, like this:
"c:\Services\ServicesChecker\ServicesChecker\bin\Debug\ServicesChecker.exe"
Related
I want to open a specific solution (.sln) in visual studio directly from the command line.
Using the command, I tried
devenv "full-path-to-sln-file.sln"
but it didn't work.
How do I do this?
You can just use explorer.exe !!
In your command line type in:
explorer mysolution.sln
Use the full path to the devenv.exe executable and the full path to the sln solution file, both wrapped in quotes and with a space in between. If your solution file is in a network path, make sure that it does not require authentication before accessing the destination folder.
C:\Users\YourWindowsUser>"D:\Visual Studio\Common7\IDE\devenv.exe" "\\networkDirectory\profiles\Desktop\VisualStudioSolutions\Project999.sln"
I wrote an open source application called OpenVSSolution to do exactly this.
Essentially:
Put this helper exe somewhere in your PATH
The exe scans the current directory for a .sln file
The exe opens devenv passing in the sln file
The explanation is on here:
https://davemateer.com/coding/2018/11/14/Open-visual-studio-from-command-line.html
I find this incredibly useful and is how I open all solutions.
You can open a solution file with Visual Studio directly if you are within a folder that contains the solution file, looking for it recursively (Powershell 7.0) by doing the following:
Open powershell, type
echo $profile
Open up the location of your profile, save the below into it:
function vs
{
Get-ChildItem *.sln -Recurse | Invoke-Item
}
Then just type vs into a folder and it will go through the sub directories looking for the solution file and open one if found
Try WhatsNew. From the readme:
Why fish around for Visual Studio solution files using Windows Explorer when you can find and launch them from your terminal window with just three little letters? Run sln (an alias for Open-Solution) to recursively search your current working directory for a solution file and launch it, if one is found.
for macOs I just use:
open projectname.csproj
it will open it in visual studio 2019 for me
Im trying to make this launcher for my game.
But I can't seem to find anywhere, how to open a file. Without specifying the location.
Like I want it to run a file, from the same folder as the .cmd file is in. (The one I created).
Been searching for ages, without finding out how.
Reasoning: The user is able to change where the game is going to be installed. So I cant specify a location..
Simply open Command Prompt. Then Drag and Drop your .exe file to the console. (This will copy the location of the .exe file to the console) Then just press "Enter". Then your .exe file should be running.
References http://www.howtogeek.com/209694/running-an-.exe-file-via-command-prompt/
Hope it helps
The argument %0 of a batch file references the name of that batch file. So to run an exe located in the same folder where your batch file is, use:
%~dp0program.exe
The ~dp expands the argument %0 to a full qualified path name - including a trailing \ that's why there is no \ between %~dp0 and program.exe
Details about expanding variables can be found by typing help for on the commandline
Turned out, it was just me being foolish.
Forgot that I could just type in the name of the file.
Instead of doing something big out of it.
Thanks #ByteHamster for refreshing my memory :)
"Quote" ByteHamster: If you are in the same folder, just type in the name of the exe file.
When cvs is typed in cmd.exe in windows 7 nothing is output. The path of the cvs is already in the PATH :C:\Program Files (x86)\CVSNT\; When typing "C:\Program Files (x86)\CVSNT\cvs" there are outputs there. But when other .exe e.g. calc is typed the corresponding program can be executed. Any idea?
This might sound like a strange suggestion, but try cvs.exe instead of just cvs. Without specifying an extension, your operating system will search for the first file that matches the name, cvs. If it happens to find cvs.bat in one of your paths, then it will execute the .bat file instead of the.exe.
If you have cvs.bat , cvs.com, and cvs.exe within the same directory. The order of precedence would be the following:
cvs.com
cvs.bat
cvs.exe
I have a strong suspicion that there's a blank cvs.bat file hidden somewhere in one of folders defined in your path variable, and that you are actually running this batch file when you type cvs.
HI the answer is Run the exe with full path like "C:\Program Files (x86)\CVSNT\cvs.exe" followed by CVS arguments like -q Checkout.....
My program needs .bat file to run because the .bat file is changing some language settings, so .bat file looks like:
set lang=en
start ap.exe
It is working great but when I made installer for my app and pointed .bat file as main file, it creates a shortcut on the desktop to that .bat file. So far everything is great but when I launch that shortcut it cannot open app.exe because it can't find it on desktop.
So my question is: How can I get path to folder of .bat file so I could set proper start command? Something like:
set lang=en
S=getpath();
start S/app.exe
It is just pseudocode but I think you get point.
You can write %~dp0 to get the directory containing the batch file.
Therefore, you can write
"%~dp0app.exe"
I am trying to create a file in Windows XP that is only the extension (".classpath" and ".project"). While my Linux box handles this appropriately, Windows gives me the error, "You must type a file name."
Any suggestions how to do this? I am attempting to setup an Eclipse project where I can bring in the classpath and project files from someone else's setup and I keep getting the above error.
Just name your file with additional dot at the end: ".ext."
explorer will remove additional dot and you'll get .ext file.
use the commandline to do this, windows explorer doesn’t allow renamed files to start with a period. first create the file/directory with a dummy name x.ext, then fire up cmd.exe and rename it:
ren x.ext .ext
this way you can also create directories which names start with a period (like .git or .meta)
From the command line:
echo some text > .classpath
Windows seems not to be in control of how Save dialogs handle forbidden characters
Quoting the filename should do the job.
I have no Windows machine to try it out but I was able to save a ".htaccess" file in Notepad this way.