1.

Solve : Using Custom System32 commands in a batch file.?

Answer»

You can create a custom Command Prompt command by making the batch file and placing it in system32, but since batch files open up using commands from system32, couldn't you use the custom commands in your batch files ?you can create a batch file that does whatever you want. and call it from anywhere (like command prompt commands - they are just files in system32.) As long as the new 'command' is in a directory on the path environment variable (and on the list of files to use). change both these properties by right clicking My Computer - properties - advanced system settings - environment VARIABLES.

Hope i explained this well enough.

FBQuote

you can create a batch file that does whatever you want.

Not necessarily. I wish my batch file could find the IP address of the specified user out of the local area range . Well, I tested it out, I made a few commands to save me some time and confusion when I'm making batch files.you gonna follow me around and correct the slightest things in my post for the rest of time?Maybe, possibly, I'm a very specific person. sorry i didn't mean that. Have you got whatever it is you want working?

FBYes, the custom commands work just fine, though the programs with the custom commands can't be shared
because the user wouldn't have the custom commands, but other then that I'm all good.Wait, how do you add commands?he isn't adding commands, he is making batch files with the same name as the command he wishes to create. this effectively creates a new custom command. Personally I just call them batch files in any context.Quote from: BC_Programmer on January 05, 2009, 04:46:12 PM
he isn't adding commands, he is making batch files with the same name as the command he wishes to create. this effectively creates a new custom command. Personally I just call them batch files in any context.

Would this not create confusion not to mention some surprising results. If files in the same directory have the same name with different extensions (format.com and format.bat), ties are BROKEN by the pathext variable which determines the sequence in which the extensions are executed. Debugging would be a nightmare.

Yes, you can override the system by specifying the extension to execute (if the user specifically launches format.bat, then format.bat will run ahead of format.com), but why create a potential problem only to jump through hoops to get around it?

FB has the right idea. Put your homegrown executables in their own directory, put the directory on the path, and give unique names to your files. You can STILL use the system commands in your files, but with less confusion over which version of a command actually got called.

Just my two cents.
additionally, the only time I "subclass" an existing command is to either enhance or reduce the functionality of the original.

Take the Old versions of DOS, 3.21 for example, where the FORMAT command would not provide an additional warning when formatting the HARD disk.

lots of people would type simply "format" and simply say Y to the prompt. And their C: would be formatted.

Then some people simply wrote a batch that wouldn't allow for the fixed disk as an argument, or provided additional prompting.I have created a program that searches system32 for anything with that name so, in the end I think I will not have any file path confusion and such.Quote from: BatchFileCommand on January 07, 2009, 03:28:03 PM
I have created a program that searches system32 for anything with that name so, in the end I think I will not have any file path confusion and such.

with what name?The name of an existing file.


Discussion

No Comment Found