CMD Redirection not Working — .exe Opens New Window - cmd

Windows 7.
I may (or may not) have done something to the Firmware in my video card. I am trying to run nvflash, to investigate and fix the problem.
The whole scenario has been plagued by numerous appalling inadequacies, including the fact that the #BIOS installer does not tell you the name nor location of the program being installed. For all I know, nvflash is the wrong program.
I am trying (at this stage) to run "nvflash /a", to get a list of applicable (and seen) video cards.
Each time I execute the command in the CMD window, it opens a new window, displays the output there and then immediately closes the window.
I have tried using | > and >> and (after teething problems with these) I am getting no error messages, but not output in the text file.
The command I am using is as follows.
nvflash /a >> "c:\users\adminaccount\my documents\out001.txt"
I have also tried adding 2>&1 .
Any help would be greatly appreciated.
p.s. As usual, I note that I resent my [spaces added for readability] being deleted. If the commands are obscure... don't blame me.
p.p.s. I don't understand why it is not originally designed to display useable output.

(Disclaimer: I don't know anything about the internals of nvflash)
I would suspect that >> (append to file) expects a file to exist on which further lines can be appended. Use > instead to always create and overwrite the file.
Also... does nvflash open up a window(=GUI Window) or a command window (=console window like the one from cmd.exe). If it is the latter one, then nvflash internally does not write to standard out (that is, the already existing cmd window) but creates a new cmd.exe process to write to... in both cases the redirect with > or >> won't work :(

Related

why does command window opens then close then open another window

I know this question looks like dozen of others: but, I am trying to get insight into why this script acts the way it does and if there is any draw back to it like memory leak or other.
The script its simple:
cd "C:\me\python\.venv" && start C:\me\python\.venv\env\Scripts\activate
There is a windows that opens briefly then closes then another command window opens with the virtual environment open as I need. This question is not about the virtual environment in any way. I am trying to understand the command window.
It seems buggy that a command window opens to change directories then closes and then another opens the virtual environment in another window. I can live with this I guess until I run across a seemless way to do this; but, isn't there a better way to do this?
Is the window opening then closing the behavior of the command prompt when changing directories? No! The script could be written simply as:
start C:\me\python\.venv\env\Scripts\activate
and there is still an occurence of a window opening prior to the window with the virtual environment started.
Is there any after affects from doing it this way, like background process open or memory leak or what have you?
Anyone know where to read the "readme" on this behavior?
Thank you much!
Use this code:
cd "C:\me\python\.venv" && C:\me\python\.venv\env\Scripts\activate
the start command is not necessary and that's what opens one more window and lets the previous one close.
This command create a new windows asynchronously.

Crt library changes console encoding, pascal

I generated a table into console and it went great but when i add "uses crt;", the labels, lines etc. which I made using chr(ord.value); , and also language special characters go wild, so I guess it somehow changes encoding.
I work in Win7,FPC IDE v.2.6.4
Another wierd thing is that when I run the program, it starts in cmd.exe classical Windows console but after like 10 seconds it closes itself and a new run is started in another console located in FPC window(where it doesn't close itself).
The wierdest thing is that the adding of "uses crt;" doesn't do anything with the table written into cmd.exe classic Windows console...
So my solution whould be either to work out how to change the encoding in the console located in FPC window or how to prevent cmd.exe from closing itself.
Hope Someone can help me, I'll really appreciate it.
If youd don't use Crt, then output is using standard DOS routines. Crt unit redirects the Input and Output standard text files to CRT instead to DOS's standard input and output files. But you can explicitly assign it back by executing:
Assign(Input, ''); Reset(Input);
Assign(Output, ''); Reset(Output);

How to run Octave from a Notepad++ file line by line or by sections?

I am looking for a way to have my Notepad++ window open for editing my code and run it line by line or by sections (more than 1 line) while I am editing. It would be like having a real IDE; the output could be shown in the same window (Notepad++) or directly in the Octave window.
I have tried what many many sites say. That is, writing this:
C:\Software\Octave-3.6.4\bin\Octave\Octave-3.6.5.exe "$(FULL_CURRENT_PATH)"
in the Run window in Notepad++, saving and giving it a shortcut. However, it is still not working. When I tried to run it, the black window starts showing-up but then it disappears and nothing else happens. In my Notepad++ window I have only one line (for now) where I have tried just "b=4" or "3*4". I have done this with and without semicolon at the end. Nothing happens.
I have Windows 8.0, Notepad 6.5.5 and Octave-3.6.4. I already change the octaverc file in Octave to make it work with Notepad++. I have work already only in the command line in Octave and is working fine. The Octave I installed was exactly "octave-3.6.4-vs2010-setup", it says it was compiled for Visual Studio 10. Is that the reason why this is not working?
Any help will be appreciated...
regarding Octave not processing the command: use supposed command line outside the N++ and see if it works. If not, find a way to make it working, then transfer it back to N++ (and use the token "$(FULL_CURRENT_PATH)" instead of concrete filename)
regarding running the code in smaller portions: if you app can accept the code directly in the command line (SQL command line tools I use can do this), then you can use token "$(CURRENT_WORD)" what stands for content of current selection (all tokens are in wiki)

My Ruby files don't run correctly

When i click on a .rb file to run it a CMD window pops up for a brief second and then closes again. This is probably a really nooby question thats easily fixed but i've looked everywhere for help. But like i said it pops up for a brief second and i THINK while its up its executing the code but when the codes done it closes so i don't know if i'm making mistakes in code or other important things like that.
Run the program through the command prompt (CMD), that way you can see the result, otherwise the window closes when the program exits.
Alternatively, you can prevent the program from exiting by putting some sort of blocking instruction at the end of the script, such that the program waits for user input before exiting.
Press Windows_Key+R and then type CMD. Browse to the location of the file and then type ruby your_ruby_file.rb. The program is running, but Windows automatically closes the window upon completion of the command.
To get Windows to run your *.rb files through Ruby when you click on them in the UI, you have to associate the .rb extension with the ruby.exe executable. Such an association is called a "Windows File Association." Here's a Microsoft Knowledge Base article that'll tell you how to create such a thing.
http://support.microsoft.com/kb/307859

Annoyance when running scripts in Vim (Windows, Ruby)

I started using vim for my programming projects (mostly Ruby) and mostly everything works just as I want but I have a problem with compiling.
Lets say I am working on a Ruby script and I want to run it. I type :ruby sometging.rb (mapped to some other key). Then vim opens a new cmd.exe window and runs 'ruby something.rb'. Then it waits for me to press ENTER to close the window and continue working on the script.
Is there a way to configure vim on windows so that it always runs the script I'm working on in a separete window (always the same one, if none exists => open one), and not ask me to confirm with enter?
Don't know about gvim, but in normal vim you could put something like
map R <ESC>:tabnew<CR><ESC>:;%!ruby filename.rb<CR>
in your ~/.vimrc which would execute a Ruby file in a newtab when pressing R in command mode.
I've not used Ruby, but for I've found Dr Chip's RunView plugin really useful for running other interpreted languages.
Once it's installed, you can enter:
:RunView! <interpreter>
(where <interpreter> is presumably 'ruby' in your case) and it will open a (vertically if you include the !) split window with the output from passing the contents of the current window to the interpreter. Each time it is run, a new result log is appended to the end of the file (with a date and time stamp separating them).
If you have any issues with it, I'd recommend you contact Dr Chip via the Vim mailing list: he's very helpful (in fact he wrote the original version of RunView in response to a request I made on the mailing list).
This isn't exactly perfect but I use this to launch Python scripts.
command -nargs=* PY3 !start cmd /K Python.exe "%:p" <args>
It starts up a window that stays alive and doesn't interfere with my VIM window. Unfortunately it doesn't load it into an existing window.

Resources