command line expand overwritten - windows

[Not sure if this is the right place for this question, if not, please correct me!]
I am having frequent BSOD issues with my graphics card driver. On closer inspection, it turns out there is an issue with a driver file called atikmpag.sys - an issue that other people have apparently faced many times before. I found a workaround on this website. In short, the thing I need to do is expand the driver file atikmpag.sy_ to atikmpag.sys. This should be done with the following command line (I have put the file atikmpag.sy_ in a folder called C:\test):
cd C:\test
expand atikmpag.sy_ atikmpag.sys
however, when I execute those two lines, I get a LOT of beeping noises accompanied with the following screen:
After some time, the command line will start responding again and I am left with the message 'atikmpag.sys: no such file or directory' (see image below)
Upon running expand /? I found that the /? flag was not recognized by command prompt. I needed to call expand --help, which showed me the following screen:
It seems to me that I probably installed some program that overwrote the standard windows expand command prompt function and replaced it with some tab-removal functionality. Now my question is: how can I restore/access the original windows function? Or alternatively: is there any other way I can extract the original atikmpag.sy_ file to atikmpag.sys?

You're using the wrong expand (the one which expands tabs to spaces, which makes no sense since this is a binary).
You should be using the one from the windows directory, C:\Windows\System32\expand.exe. If you've lost it try sfc /scannow if you haven't already, or if you need it quick grab it from one of the internet's download sites, and hope it's not riddled with malware.

Related

Utilizing custom environment paths from other programs with batch file proccesing

I have visited StackOverflow thousands of times and it's always incredibly useful. This will be my first question on this site, after spending the entire day attempting to solve a problem.
Long story short, I use a program who's configuration settings allow for custom user programs to be executed with a button click on the main GUI. Alongside this is an input for a cmd line option. You can see the config in this image.
Configuration Settings Window
So I have created a script to execute and have been trying with no success for the entire day. I don't imagine I have to explain what it's like to keep changing small details and even starting over again a dozen times. Basically, when you highlight an order in the program, I want to move any (*.stl) files from the orders folder. The .bat file converted to exe i tried dozens and dozens of similar scripts like the code below. I have a .bat and a .exe that work fine when I am moving a file from my own directories. But now with this very new to me, environment variable. No matter how I format it, it doesn't work. In the beginning it was always exit code 255. But now I get exit codes 0, 1, but no file copy. I have made progress and but decided I need to ask for help.
Thank you in advance.
edit: enter image description here
for /r %ORDER_FOLDER% %f in (*.stl*) do #copy %f C:\Users\Lap2\Desktop\test_dir

Octave- How to automatically execute commands on startup

I'm new to octave, and want to run a few commands on startup automatically every time it opens.
I typed "help startup" and saw "Octave uses the file ".octaverc". I did a bit of searching online at https://www.math.utah.edu/docs/info/octave_4.html, and saw the .octaverc file should be in the following path:
OCTAVE_HOME/lib/octave/VERSION/startup/octaverc
PROBLEM:
In that directory I don't have a startup folder, only "oct" and "site". I do see hidden files, which was my first thought since the file begins with "." character. So I then used Agent Ransack in the directory, and still nothing came up.
QUESTION:
1) Do I have to make the startup folder and octaverc file myself?
2) If so, does one, both or none have to be hidden?
3) Can it be a txt file, or does it have a special extension?
4) Do I just type the commands straight into the file or is there special formatting?
NOTE:
In case I'm going about this the wrong way, there are the operations I'd like to have run on startup:
PS1('>> '), addpath('D:\Users\Me\Desktop'), clc
Thanks ahead of time for the help!!
Possible locations (and their differences) for octaverc files are specified in the documentation.
In short, these are, from more general to specific:
octave-home/share/octave/site/m/startup/octaverc (most generic, for entire system)
octave-home/share/octave/version/m/startup/octaverc (to cover for more than one octave versions installed on the system, possibly requiring different startup scripts)
~/.octaverc (where ~ is unix-speak for a user's home directory -- covering for user-specific startup files)
.octaverc files in any directory, creating specific startup conditions for specific directories
octaverc files are effectively simple script files that are executed from most generic to most specific each time octave starts. Therefore, in the presence of conflicting commands, the more specific file can effectively be used to override the more generic behaviour.
Octave also supports (but does not recommend) the use of the startup.m file, for matlab compatibility.
You might also want to check out pathdef and savepath as well.
As a more general tip, if you ever want to search for a specific keyword from the documentation (e.g. octaverc), you can type this kind of search query in duckduckgo (or google):
octaverc site:https://octave.org/doc/interpreter/
(or just download the documentation as pdf and search the pdf)
Found the solution, the file was in the following path:
OCTAVE_HOME/share/octave/site/m/startup
to find out where OCTAVE_HOME is for you, just type "OCTAVE_HOME" into your Octave command line window.
ANSWERS:
1) You do not have to make a startup octaverc file yourself
2) The file is actually not hidden, so it should be easy to find given you're looking in the right place.
3) The file doesn't have an extension. It's just octaverc.
4) Under the last line of the existing file, you can just append commands as you would type them at the Octave command line window.
the last(7.3.0) octave version placed HERE:/ does not find the THERE:/openEMS/matlab directory even it is already loaded with octaverc or addpath. It keeps looking into the work dir where openEMS is not placed and does not recognize, for instance, the 'physical_constants.m' file.

Windows 8.1 Pro MinGW Gfortran Command Prompt 'not recognized command' error

C:\Users\redacted\Documents\redacted>gfortran hibrac.f -o hibrac.exe
'gfortran' is not recognized as an internal or external command,
operable program or batch file.
https://gcc.gnu.org/wiki/GFortranBinariesWindows seems similar to my problem: gfortran.exe is in C:\Windows\MinGW\bin -- except the solution appears not to apply to Windows 8.1 Pro:
Right click on My Computer, Properties, Advanced Tab, Environment Variables.
Instead I tried: Right click on 'This PC' within File Explorer, Properties, Advanced system settings, Advanced Tab -- and I cannot find an equivalent-looking section that allows me to proceed with the advised solution.
As background information:
I had installed MinGW Installation Manager which installed mingw32-gcc-fortran (together with mingw32-base, -gcc-g++, and -gcc-objc) in the recommended C:\Windows\MinGW folder, without any apparent error message.
Isn't it acceptable -- standard practice -- to have one's code in a folder separate from this MinGW folder? i.e. a subdirectory of my Users\account rather than a subdirectory of MinGW. This isn't the problem, is it? What do I need to do to get it to recognize the gfortran.exe, or call it correctly?
Please tell me what to do to get it working. If it's relevant, I have a Japanese computer with an English language pack installed (it seems to have some gaps, such as some text in the Settings charm or startup/shutdown text being in Japanese).
This looks very much like you have neglected to add C:\MinGW\bin to the effective PATH for the command window, in which you are attempting to run the gfortran command.
Your question isn't entirely specific on this point, (i.e. you could improve the question), but you hint that you were unable to add the appropriate PATH entry to the global environment variables, because you couldn't find the appropriate control panel applet? I know that this is often recommended as part of a MinGW setup, but the installer will not do it for you, because I, as the maintainer of mingw-get, don't consider that to be best practice; much better, IMO, to add it for each specific command window in which you need it to take effect, by running (once, at the start of each command prompt session) the command:
path %PATH%;C:\MinGW\bin
If you prefer, you may create a batch file to do this for you, along with any other initializations you wish to perform, (or better still, use MSYS as the working shell environment, in which case the PATH initialization is taken care of by the shell's own initialization scripts).

how do I run my .py file from within python command line?

background info:
I know this question has been asked countless times, but I'm not understanding the answers.
Today is the first time I've ever done anything with python, so I'm a total noob.
I'm using windows 7.
python 3.3.5 lives here: C:\Python33\python.exe
I have a .py file I want to run saved here: C:\Users\Scydmarc\Documents\cs188\python_basics\myfile.py
If I simply double click on myfile.py, it opens, runs, and closes super fast. By doing a perfectly timed printscreen, I can see that it works. It is my understanding that I need to run the file from within python.exe to get the window to stay open and allow me to mess with variables etc after it runs. So I open python.exe. What exactly do I need to type to run myfile.py? I've found lots of people trying to do this, but I guess I'm not understanding the answers. When I try to follow along, I get tangled up with errors. Do you still need to put python before the file name while in the python.exe window? Do I somehow need to specify a full path to the file? Some are actually running from the windows command prompt and not the python command prompt. When trying to change PYTHONPATH, are you supposed to do that from inside python, or the windows command prompt? Some examples use '/', while some use '\'. So, I think a complete example (what to actually type, in what window, line by line, with real filepaths) would clarify a lot for me and be super helpful. I'm thinking if I can actually see it done once, I can figure out how to make it do what I want in the future. Thanks for any help you can give.
in your python dir type python.exe pathtofile.py or set python.exe to your classpath
edit: https://www.youtube.com/watch?v=IokKz-LZsEo

How do I save my command snippets for quick access from the commandline?

I have a huge file with all the commands I use on and off the commandline. This file is getting harder to open and navigate as its size gets larger. I am looking for a commandline utility that makes this process easier. I found this gem, which does something similar to what I want, but it's terrible with long lines of code with multiple quotation marks.
What does everyone use to keep your code snippets and easily access it from your terminal?
I keep a similar file myself. This example isn't directly useful with your file. However when I find that I need to run a particular command I recently used, without looking it up again, I run a grep on history.
For example:
history | grep "svn co"
You may try Komandi, a multiplatform command snippets manager.

Resources