Error when i run a shortcut using it's path in cmd - cmd

I have a problem whenever I try to run some paths,
for example :
C:\Users\Dell\Desktop\Menu\program.lnk
I had this error:
not recognized as an internal or external command operable program or batch file.
As you can see this not a problem of space in the path, how can I solve this?

Having Tested This in the command prompt myself I found that on my windows 7 machine the command prompt doesn't like me appending the '.lnk' file extension on the end yet it seems to work to when I remove it. Other than I am not too sure. Could be a problem with the shortcut or the executable but I doubt it.

i just had to add cmd /C as prefix of the command

Related

Error opening a file with atom from the command line (Windows 10)

I just spent some time messing around with my environment variables. I used to be able to type "atom [filename]" into the command prompt and it would open the file in atom (provided I was in the correct directory). Now when I try this, I get the following message:
'atom' is not recognized as an internal or external command,
operable program or batch file.
I've looked at several threads about this and I have added the path:
C:\Users\[username]\AppData\Local\atom\bin
to my Path variables (both user and system). Why is it still not working? It has worked in the past and I'm not sure what has changed.
1/3/2019 Update:
I can open it if I type atom.cmd, but when I removed the .cmd extension and it stopped working. I still am not quite sure why it can't be recognized as a command without this extension as my computer did used to be able to recognize it.
Found the issue:
In my system variable PATHEXT, I did not have the extension cmd, just CMD. These extensions are clearly case sensitive, because adding cmd fixed the problem.

Adding lua.exe to my system path

I've been having difficulty setting up lua as a system path. I'm attempting to run lua programs via the command prompt. I've followed multiple stackoverflow answers for similar questions:
Running a lua program from a text file
to no avail. Regarding the link's four steps: I'm able to complete step one no problem, would like to complete step three and step two onward have thoroughly confused me.
I've edited my PATH variable to include what I believe the correct path for lua is: C:\Program Files\Lua\5.3.4_64\lua53.exe. I feel like this is where I'm botching it.
This is the general output when I try to run lua from a cmd prompt within the folder holding lua.exe or outside of it.
C:\Program Files\Lua\5.3.4_32>lua main.lua
'lua' is not recognized as an internal or external command,
operable program or batch file.
If anyone can help or needs more information to help please let me know and thank you in advance.
You need to add the folder of lua53.exe to the PATH variable. That is, add C:\Program Files\Lua\5.3.4_64, not C:\Program Files\Lua\5.3.4_64\lua53.exe. Then when you type lua53 in the command prompt, the command processor will search in that folder for lua53.exe and run it.
If you want to run Lua in the command line with the name lua, you will have to rename lua53.exe to lua.exe, or create a batch file named lua.bat with the content lua53 %* and save it in the same folder as lua53.exe. (%* is a variable that copies the arguments that you typed after the name of the batch file. That is, if you type lua -e "print 'Hello, world!'" in the command line, it will execute the command lua53 -e "print 'Hello, world!'".)

Running a batch file through command prompt - system cannot find the path specified

I am trying to uninstall Oracle on this Windows 7 (64 bit) machine by downloading a standalone tool from Oracle, I need to run a batch file that is supposed to uninstall but I am unable to run it.
I tried to open command prompt as administrator and I am trying to run this as below:
As you can clearly see from the screenshot, I am doing a "dir" on the directory and can clearly see the file right there. Not sure what's going on here.
I also tried to run the batch file by double clicking from Windows Explorer and a terminal window opens and closes quickly but the batch file is not doing what it is supposed to do (it is clearly not executing from Windows Explorer).
Can anyone help me with this?
As theB pointed out above in a comment, this worked for me:
Open the bat file in notepad. I'll bet it starts with #echo off, and
that the error is actually coming from inside the batch file. The
error if the batch file itself wasn't found is 'X' is not recognized
as an internal or external command, operable program or batch file
'Run as Administrator' changes the current directory. See my answer here
Difference between "%~dp0" and ".\"?

Current directory and parent directory seem broken

I have Windows 8.1 and I have a strange problem.
When I launch a Command Terminal, it seems that current directory and parent directory don't work when I try to use it to launch executable.
For example, considering the following folders :
C:/dirA/dirB/program.exe
C:/dirA/dirB/dirC
I put dirA/dirB in the PATH variable.
So, when I launch program.exe in Command Terminal, it works.
But, if I go in C:/ and launch the following command :
./dirA/dirB/program.exe
I got the following error :
'.' is not recognized as an internal or external command, operable
program or batch file.
Error is the same if I go on C:/dirA/dirB/dirC folder and launch the following command :
../program.exe
Error is :
'..' is not recognized as an internal or external command, operable
program or batch file.
So, I don't understand what is the problem and how to solve it. Someone have an idea and can help me ?
Thanks for your help.
Sylvain
If you want to use forward slashes (/) with paths in Windows Command Prompt you need to quote the whole path.
"./dirA/dirB/program.exe"
If you use backslashes (\) then you don't have to quote paths (unless your path contains spaces).

Where does windows cls.exe reside?

As we know windows CMD can clear the scren by cls.exe command. But I cannot find the command location.
Usually, I can use which to find the location of the command program file.
But for cls.exe, it does not work, and displays as:
which: no cls in c:\Windows\System32...
Could you guys help me how cmd works? I searched on the internet, only finding clues on how to use it. Not how itself works!
There is no cls.exe. 'cls' is an CMD.EXE internal built-in.
It's built-in command to cmd.exe and not a stand-alone program.
i.e. cls.exe does not exist:
C:\>"cls.exe"
'"cls.exe"' is not recognized as an internal or external command,
operable program or batch file.
C:\>"cls.com"
'"cls.com"' is not recognized as an internal or external command,
operable program or batch file.
C:\>"find.exe"
FIND: Parameter format not correct
The last one, find.exe, is just there to show what happens when it exists.

Resources