This is strange: in general, .bat scripts work fine on this machine. So the PATH variable is fine.
However, I have one script that creates the error message
--> 'C:\Windows\system32\cmd.exe\' is not recognized as an internal ....
Here is the one-line script:
--> #echo %1 | "C:\Program Files\putty\PSFTP.exe" -pw xxx User#Host
This script is working fine on two other Windows 7 machines, just not on mine.
Any ideas what to check?
Is it possible you are using a 64bit version of Windows?. The path may need to be set to point to "C:\Program Files (x86)\Putty"
Actually, the problem had nothing to do with the specific command. Even a
dir | dir
from the command line threw the same error.
I did find the solution here:
https://superuser.com/questions/557387/pipe-not-working-in-cmd-exe-on-windows-7
Problem was the environment variable ComSpec; somehow it had a bad character in the field. I removed that darn back-slash and all is fine.
Thanks for looking at my problem.
Related
I am 100% sure that I have the exe application. The exe application is DriverBooster.exe. It will not start the program with the command `
#echo off
start DriverBooster.exe
`. I searched my computer and found the exact file in C:\Program Files\IObit\Driver Booster, with the exe so then I wrote
#echo off
start C:\Program Files\IObit\Driver Booster\DriverBooster.exe
`
But it still shows that Windows cannot find the program "DriverBooster.exe", try fixing spelling mistakes. I also checked the spelling and its 100% correct. I am using a batch file and editing it with "notepad" (Yes a regular notepad). Please someone help.I would greatly appricate anyone helping, thank you!
It might be due to the space in the file location, try this:
#echo off
start "" "C:\Program Files\IObit\Driver Booster\DriverBooster.exe"
EDIT: Added extra set of quotes as suggested by Squashman - it has been a while since I've done bash :)
I want to create a batch file to launch my executable file after it has made some changes to itself.
My batch file is:
START /D "C:\Users\me\AppData\Roaming\Test\Test.exe"
When I run it though I just get a brief console flash and Test.exe doesn't start up.
I've verified the EXE is there in the directory.
I've launched the exe manually to verify it is working as well.
My batch file resides in
C:\Users\admin\AppData\Roaming\run.bat"
There are two issues:
The /D option solely defines the starting or working directory, but not the program to execute.
The start command considers the first quoted argument as the title of the new window. To avoid confusion with other arguments, always provide a window title (that may also be empty).
There are two solutions, which are actually not exactly equivalent:
Remove the /D option, so the current working directory is used:
start "" "C:\Users\me\AppData\Roaming\Test\Test.exe"
Keep the /D option and explicitly provide the new working directory to be used:
start "" /D "C:\Users\me\AppData\Roaming\Test" "Test.exe"
try changing to this
start /d "C:\Users\me\AppData\Roaming\Test" Test.exe
You will see the console flash and your program should startup.
Update
Thanks for #SomethingDark 's suggestion to use the following code.
start "" C:\Users\me\AppData\Roaming\Test\Test.exe
However, the above code will not work if your filename contains space.
Try with the following command.Add it to your batch script.Notice that you have to add double quotes after start keyword if there is/are whitespaces in the path string.
start "" "C:\Users\me\AppData\Roaming\Test\Test.exe"
Enclose any directory names which are longer than one-word into quotation marks. So the following path:
start C:\Program Files\MySQL\MySQL Workbench 8.0 CE\MySQL.exe
Should become something like this:
start C:\"Program Files"\MySQL\"MySQL Workbench 8.0 CE"\MySQL.exe
I am trying to run the following batch command. The command has been extracted from the IDE so is confirmed working. Getting the error mentioned below.
I have tried a few variations with double quotes but they haven't worked.
Even on powershell it has the same message.
C:\Program Files\IAR Systems\Embedded Workbench 7.0\430\bin\icc430.exe F:\CP001\source\Meter\Main.c -D Hardware_P20E -D Calibration_code -D _Optical -D _Configuration_TS0382 -o F:\CP001\Temp\C20EO\Obj\ --no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --debug -D__MSP430F425 -e --double=32 --dlib_config C:\Program Files\IAR Systems\Embedded Workbench 7.0\430\lib\dlib\dl430fn.h -Ol --multiplier=16 --segment __data16=DATA16 --segment __data20=DATA20
Update:
Trying the solution with quotes confuses the compiler in some way
If a directory has spaces in, put quotes around it. This includes the program you're calling, not just the arguments
"C:\Program Files\IAR Systems\Embedded Workbench 7.0\430\bin\icc430.exe" "F:\CP001\source\Meter\Main.c" -D Hardware_P20E -D Calibration_code -D _Optical -D _Configuration_TS0382 -o "F:\CP001\Temp\C20EO\Obj\" --no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --debug -D__MSP430F425 -e --double=32 --dlib_config "C:\Program Files\IAR Systems\Embedded Workbench 7.0\430\lib\dlib\dl430fn.h" -Ol --multiplier=16 --segment __data16=DATA16 --segment __data20=DATA20
You just need to keep Program Files in double quote & rest of the command don't need any quote.
C:\"Program Files"\IAR Systems\Embedded Workbench 7.0\430\bin\icc430.exe F:\CP00 .....
This seems to happen from time to time with programs that are very sensitive to command lines, but one option is to just use the DOS path instead of the Windows path. This means that C:\Program Files\ would resolve to C:\PROGRA~1\ and generally avoid any issues with spacing.
To get the short path you can create a quick Batch file that echos the short path:
#ECHO OFF
echo %~s1
Which is then called as follows:
C:\>shortPath.bat "C:\Program Files"
C:\PROGRA~1
Try putting cd before the file path.
Example:
C:\Users\user>cd C:\Program Files\MongoDB\Server\4.4\bin
If a directory has spaces in, put quotes around it. This includes the
program you're calling, not just the arguments
"C:\Program Files\IAR Systems\Embedded Workbench
7.0\430\bin\icc430.exe"
Also - SPACES in your "${workspaceFolder}" (dir to your project) can confuse the compiler!
At least mine was throwing various errors (like that above, but I had fixed the compiler path), I finally noticed it compiled on PC 1 (dir without spaces) and would NOT compile PC 2 (dir with spaces).
Actually don't know where to put quotes ("") to make this work because ${workspaceFolder} or ${fileDirname} are a predefined variable reference in VSC...
I encountered a similar problem using windows command line for R script, Rscript.exe, which is very sensitive to spaces in the path. The solution was to create a virtual path to the binary folder using the windows subst command.
The following fails: "C:\Program Files\R\R-3.4.0\bin\Rscript.exe"
Doing following succeeds:
subst Z: "C:\Program Files\R\R-3.4.0"
Z:\bin\Rscript.exe
The reason the above-proposed solutions didn't work, evidently, has to do with the Rscript.exe executable's own internal path resolution from its working directory (which has a space in it) rather the windows command line being confused with the space. So using ~ or " to resolve the issue at the command line is moot. The executable must be called within a path lacking spaces.
Most of the times, the issue is with the paths you have mentioned for 'java home' and 'javac' tags in settings.xml which is present in your .m2 repository and the issue is not with your path variable or Java_Home variable.
If you check and correct the same, you should be able to execute your commands successfully.
- Jaihind
Just go to the folder path and type cmd on it. Then press ENTER
enter image description here
You can go to folder by doing on first line and next line call exe like below.
cd 'c:\program files\....'
.\abc.exe --install service
I believe James Hunt's answer will solve the problem.
#user3731784: In your new message, the compiler seems to be confused because of the "C:\Program Files\IAR systems\Embedded Workbench 7.0\430\lib\dlib\d1430fn.h" argument. Why are you giving this header file at the middle of other compiler switches?
Please correct this and try again.
Also, it probably is a good idea to give the source file name after all the compiler switches and not at the beginning.
Go to Start and search for cmd. Right click on it, properties then set the Target path in quotes. This worked fine for me.
I need to invoke an exe file in C:\Program Files directory from a batch file.How can we mention the directory name "Program Files" in batch file.I am getting error like C:\Program not found.
I believe that % or ~ needs to be added in between but couldn't get it.Kindly assist.
Surround the script call with "", generally it's good practices to do so with filepath.
"C:\Program Files"
Although for this particular name you probably should use environment variable like this :
"%ProgramFiles%\batch.cmd"
or for 32 bits program on 64 bit windows :
"%ProgramFiles(x86)%\batch.cmd"
On my pc I need to do the following:
#echo off
start C:\"Program Files (x86)\VirtualDJ\virtualdj_pro.exe"
start C:\toolbetech\TBETECH\"Your Toolbar.exe"
exit
Now that bash is out for windows 10, if you want to access program files from bash, you can do it like so: cd /mnt/c/Program\ Files.
I use in my batch files - c:\progra~2\ instead of C:\Program Files (x86)\ and it works.
I had a similar issue as you, although I was trying to use start to open Chrome and using the file path. I used only start chrome.exe and it opened just fine. You may want to try to do the same with exe file. Using the file path may be unnecessary.
Here are some examples (using the file name you gave in a comment on another answer):
Instead of C:\Program^ Files\temp.exe you can try temp.exe.
Instead of start C:\Program^ Files\temp.exe you can try start
temp.exe
use this as somethink
"C:/Program Files (x86)/Nox/bin/nox_adb" install -r app.apk
where
"path_to_executable" commands_argument
Interestingly with variables ,this worked for me ...
SET "VESTADIR=\\%TARGET%\C$\"Program Files (x86)"\Cassidian\VESTA"
While createting the bat file, you can easly avoid the space. If you want to mentioned "program files "folder in batch file.
Do following steps:
1. Type c: then press enter
2. cd program files
3. cd "choose your own folder name"
then continue as you wish.
This way you can create batch file and you can mention program files folder.
I'm running an exe with multiple arguments that may or may not contain spaces. I encloses them with quotes but they are somehow not passed to the exe correctly.
Here's the command i'm using:
makeblastdb -in "D:\d b\sequence.fasta" -input_type fasta -dbtype prot -title xd -out "D:\d b\xd"
which I think cmd should pass 10 arguments to the exe but somehow it isn't passing correctly.
this is the result i get
BLAST options error: File "D:\d" does not exist.
which is basically saying that the second argument is being chopped for some reason?
Any help will be appreciated, thanks!
Based on your comments to your question, the BLAST utility does not properly handle quoted paths with spaces, and your volume does not support short file names.
Obviously you can move your working directory to a path that does not contain spaces.
An alternative is to use SUBST to temporarily create a virtual drive that points to your problematic path.
subst K: "d:\d b"
makeblastdb -in "K:\sequence.fasta" -input_type fasta -dbtype prot -title xd -out "K:\xd"
subst /d K:
Type subst /? for help with the command.
Update based on fact that you are running the command from within python
In your comment to this answer, you state you will attempt to get the command to work from within python. That could be the entire source of your problem.
You should try to run the command in your question directly from a Windows command prompt (cmd.exe console).
If the command does not work from the command prompt, then the problem is indeed with the BLAST utility, and SUBST is a good solution.
If the command does work from the command prompt, then the problem is with how you are shelling out the command from python, and the SUBST command should not be required.
I'm not a python user, but I see that many people have similar problems when using python on Windows. Perhaps this will help: How do I execute a program from python? os.system fails due to spaces in path
makeblastdb has an odd escaping convention. Try this:
-in \""D:\d b\sequence.fasta"\"
Unfortunately this doesn't work for -out, so dbenham's answer is probably best.
Alternative is you can try using directory shortname for "D:\d b" which you can find by running dir /X command on your D drive. For instance if I run dir /X on my C drive here is what I get:
01/21/2013 09:47 AM <DIR> PROGRA~1 Program Files
So you want to use C:\Program Files you can alternatively use C:\PROGRA~1.