I installed ender js and am running it from the command line. It generates a file called ender.js. Whenever I run the command "ender info" or anything with ender in it, it opens the ender.js file in notepad.
How can I stop the file from opening and get the command to run? It runs when I delete the file, but I need the file.
Windows runs it's own JS executor in the command line. This is in the PATHEXT system variable. This system variable stores an order for file extensions to be executed if there are files in the current directory that match. When I remove JS from that list, the command I am trying to call works. It does mean I won't be able to execute JS files in the browser now, but I have never needed to do that so far.
So uou are trying to run a javascript from the command line? that is what i infered here sorry if i am incorrect. That is done with the C:> cscript jslint.js command from the command line.
You can usually get around this by typing ender.cmd or ender.bat (depends how it is installed).
Related
I have a program that creates a temporary file and uses cmd to open it (with the user's default pdf viewer). I want to delete the file after they're done with it.
How would I know when the user closes the file/closes the program that opened it?
I've tried putting an && <do thing> at the end of the command, but it seems to run immediately.
If it matters, it's actually a node project running child_process.exec()
Please help me out, i am new. "ls" command for list doesn't work on my Node.js most times. It is not working now. However, it works sometimes though. How can i find list of current directory or file in Node.js?
As per to my tutorial for Node.js, i have to use command "ls" to see the list of my current directory or file.
When i press enter on ""ls" it replied "ls" is not found as internal or external command."
However, "ls" command shows the contents of file sometimes. I am using "ls" command for Desktop listing and another file in their. I do go to Desktop by cd Desktop. and then i only write "ls" then enter.
Please reply with simple explanation since i am new and learning Node.js.
i am taking Essential Node.js training from Lynda.com. "ls" did worked earlier though. "ls" does work on Window Shell and Bash all the time. Please reply. Thank You.
If not, what command i shall use for listing current directory or file contents?
Windows operational system provides the command dir instead of ls which should work similarly in your case:
Just use:
dir
I am pretty new to this programming field and am stuck at a place.
This is wat i wanna do
I want to run an .exe from command line with parameters in Windows 7 through c++ and get the output produced by the command into the program.
the problem I am having is with changing the current directory of command prompt to the path of the exe and getting the output from the executed command into the program..
hope some one has ran into something such previously..
Thank you.
You can use System function or ShellExecute function for running exe from command line with parameters using Cpp. You can read about System function here and ShellExecute function here. As far as getting the output is concerned you can redirect the output to a file and read the file, or create pipes and redirect the output to pipe. You can provide the exe name along with the path so cd to directory wont be necessary, but I am not sure if its mandatory for you to run the exe from inside the same directory.
I created executables of a python script (via pyinstaller) for Mac, Windows and Linux. For Linux and Mac, I am running them in the shell since it doesn't have an own interface: just open a shell and type the name of the program.
I am wondering if there is a way to use certain file ending so if the user clicks on the program, it will be automatically executed in the shell or terminal. Alternatively, I would appreciate any other ideas of how to do this.
The way to do this is not to append a certain file ending, but, as pointed out in the comment, make the file executable (chmod +x <file>) and add the magic bytes to the beginning of the file that tell the system how to execute it.
The magic bytes are #! and are followed by the path to executable. So for a python script you would put something like the following at the top of the file:
#!/usr/bin/env python
Okay, now I finally found out the solution to my question. All you have to do to execute the program upon clicking on it in the file browser is to add the ending .command and make it executable
E.g., exampleprogram.command. Clicking on it will execute the program in the shell
I have to work on a project in Fedora Linux and I have to type the following very often:
player map1.cfg &
I figured out that I can create an executable .sh file and it contains this:
#!/bin/bash
player *.cfg &
However, when double click on the runmap.sh file it shows me 'Run in Terminal', 'Display', 'Cancel', and 'Run' and when I click 'Run in Terminal' a terminal window opens and closes immediately. If I just hit 'Run' then the .cfg opens but I need the Terminal window to run additional (Java) files.
How can I fix this problem?
Other information:
I use *.cfg because I want to copy and paste the .sh files into other folders that also contain .cfg files such as map2.cfg, map3.cfg, etc.
It's for a Player/Stage project.
When you run a script from the file manager, the shell that is started isn't interactive. The shell can only read the script file.
To open an interactive shell in addition to the files, you can exec the new shell at the end of the script, and use "Run in Terminal":
#!/bin/bash
player *.cfg &
exec /bin/bash
Well let's look at it this way.
When you run the command in a terminal, the command starts as a child process and is then sent to the background. Once the command finishes it terminates. During the time it is running in the background you can still issue commands because your parent process is the terminal window itself.
When you write a script that issues a command to run in the background it is started, spawns the command as a child to it and then closes because the script has finished.
These are a behavior of the OS and something that really shouldn't change. Essentially what you are therefore asking for is a way for it to run the command quickly for yourself yet still leave a command terminal for you to work with?
1) Why is typing the command such a hassle? Bash and other terminals have a history function for this very reason.
2) Why don't you just call the mini script you wrote from a terminal window whenever you need to call the commands. If you put the script in a folder on your $PATH variable it will be available to you in the terminal at any location.