Page 1 of 1
adding commands to cmd
Posted: 12 Oct 2011 01:57
by Rileyh
Hi,
this is in response to AlleyPuppy's post about adding commands by copying them to System32.
It comes up with the text "CPU has encountered an illegal command"
Why is that and how do I fix it?
Thanks,
Rileyh
Re: adding commands to cmd
Posted: 12 Oct 2011 03:30
by alan_b
There is no sensible way to tell even an expert how to "fix it".
You have not said what you did and what you want to fix.
You failed to give a relevant link to "AlleyPuppy's post",
and on a hunch I looked at
http://www.allenware.com/icsw/icswidx.htm and used Firefox Search but found no "system32".
You have been asking elementary questions about DOS.
I really doubt that it is safe for you to be putting commands into the heart of the operating system.
Thank God that it responded with "CPU has encountered an illegal command".
Had it been a legal command it would have been executed - and that could have been the death of your operating system.
You may know that "DEL *.*" can do damage if aimed at the wrong target,
but there are far worse accidents awaiting those you meddle with system32.
Windows can deliver more than enough BSOD's without user interference.
Re: adding commands to cmd
Posted: 13 Oct 2011 15:37
by alleypuppy
alan_b wrote:There is no sensible way to tell even an expert how to "fix it".
You have not said what you did and what you want to fix.
You failed to give a relevant link to "AlleyPuppy's post",
and on a hunch I looked at
http://www.allenware.com/icsw/icswidx.htm and used Firefox Search but found no "system32".
You have been asking elementary questions about DOS.
I really doubt that it is safe for you to be putting commands into the heart of the operating system.
Thank God that it responded with "CPU has encountered an illegal command".
Had it been a legal command it would have been executed - and that could have been the death of your operating system.
You may know that "DEL *.*" can do damage if aimed at the wrong target,
but there are far worse accidents awaiting those you meddle with system32.
Windows can deliver more than enough BSOD's without user interference.
The "command" was merely a batch file with that only contained commands that are on Windows by default. I said in a previous post that you can make a batch file that does a certain thing and place it in the system32 folder so it can be accessed in CMD from any directory. It was a file that deletes your internet cookies. I'm not sure why it came up with a "CPU has encountered an illegal command" error. Perhaps you aren't using Windows 7 (which is the OS that I wrote the file on).
Re: adding commands to cmd
Posted: 13 Oct 2011 15:56
by alan_b
I was only aware that the O.P. had been referred to
http://www.allenware.com/icsw/icswidx.htm and because he failed to link to your post I was not aware of your post until later in the day.
I did not have a clue what crazy commands he might have put in system32,
hence my concern that he should stop whatever he was doing.
Question
How easy is it to put "commands" into Windows 7 system32.
It gives me no problem because I have UAC fully disabled and all hidden and system files visible,
but this is not safe for a novice, and I would expect UAC to block such actions
Regards
Alan
Re: adding commands to cmd
Posted: 13 Oct 2011 16:04
by dbenham
I agree with alan_b that placing your own files in system32 is probably not a great idea.
I recommend creating your own directory and then adding that directory to your PATH instead, either at the System or User environment level. I have a \Utils directory on my machine for that very purpose. In that directory I put batch files plus 3rd party utilities that I trust.
Dave Benham
Re: adding commands to cmd
Posted: 13 Oct 2011 22:32
by Rileyh
Could you explain further about your \Utils directory dbenham?
I have a \Utils directory on my machine for that very purpose.
Re: adding commands to cmd
Posted: 14 Oct 2011 11:40
by Ed Dyreen
'
Code: Select all
@echo off
set "path"
set "path=%path%;E:\MyHome\MyUtils"
set "path"
start "" "MyFileInUtils.CMD"
Don't use quotes in lengthy paths
Re: adding commands to cmd
Posted: 15 Oct 2011 19:01
by dbenham
Ed's code demonstrates how PATH works, but I don't think Rileyh wants to invoke a batch file to gain access to another
I think he wants his "command" to be available at all times from the command prompt without having to know the path to any batch file.
There are variables that are pre-defined before your command session starts. PATH is one of them. You can change the values of these pre-defined variables as long as you have admin privileges.
There are multiple methods to get to the window that allows modification of the values, and the details can vary depending on your version of Windows. On Vista you can get to it from the Control Panel: Select System, then select Advanced system settings, then select Environment Variables. From this point on I think the various Windows versions are the same.
There are two sections: User variables only apply to you, and System variables apply to all users of the machine. If you modify the PATH in System variables then anybody that logs in to that machine will have access to your "command". Alternatively I think you can create a PATH variable in your User section, copying the existing value from System section and then modify it as you want. I believe the PATH definition in your User section will over-ride the System value, but I'm not 100% sure.
WARNING - Make sure you do not remove any directories from the PATH, only add your directory to it. If you corrupt or drop existing directories from your PATH then you will break functionality of your system and/or installed software.
The variable editor is terrible. You will be better off if you copy the entire contents of the path edit control (Control-A followed by Control-C). Then paste it into your favorite text editor. Now you can see what you are doing. A semicolon is used to separate directories within the PATH. When finished just copy the modified value back to the variable editor.
-----------------------------------------------
Ed Dyreen wrote:Don't use quotes in lengthy paths
Ed - I don't know if that is supposed to be a joke or serious. Either way I don't get the point.
Dave Benham
Re: adding commands to cmd
Posted: 16 Oct 2011 03:16
by Ed Dyreen
'
I was talking about the %path%, I believe it uses ; as separator not quotes.
But when I wan't to setx a variable, I just regwrite to the system:
Code: Select all
:: use to create environment variable
::(
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
::)
Re: adding commands to cmd
Posted: 16 Oct 2011 05:30
by alan_b
Regwrite is WAY OFF TOPIC
The O.P. is asking rudimentary questions about fundamental DOS operations in the DOSTIPS forum
and you now throw in a tiny snatch of VBScript with no clue given upon how to get a VBscript created and launched
And once a novice has accessed a rather important registry key, how safely can he blunder without GUI interaction ?
Even RegEdit is not something I would recommend for a novice.
Re: adding commands to cmd
Posted: 19 Oct 2011 00:16
by Rileyh
Alan_b
Thank you for the post. At first (being a novice!) I didn't understand what you were talking about, but I then discovered that my equivalent of "PATH" was in lowercase letters but still the same. So it now works and I am beginning to work on what I wanted.
Thank you,
Rileyh