Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Ветеран


Сообщения: 27449
Благодарности: 8088

Профиль | Отправить PM | Цитировать


mogdin, Petya V4sechkin верно доглядел (а я — нет). Вы назвали пакетный файл «attrib.cmd». Внутри него Вы используете команду:
Код: Выделить весь код
attrib +R "%Prog…
Командный процессор находит в текущем каталоге пакетный файл «attrib.cmd» и запускает его. И так по кругу.

Самый правильный путь — всегда указывать полный путь к файлу, наподобие:
Код: Выделить весь код
"%systemroot%\system32\attrib.exe" +R "%Prog…
поскольку, скажем «reg.exe», «whoami.exe», «expand.exe» могут присутствовать в нескольких экземплярах в пути (скажем, из комплектов Resource Kit'ов, портированных утилит из Unix и т.п.). К сожалению, на практике сие применяют всё же редко.

Детали инициализации запуска процесса командным процессором можно почерпнуть в:
Launching Applications from the Shell
читать дальше »
Цитата:
Command Search Sequence

When a command is submitted for execution (either by typing or as part of a script), the shell performs the following actions:

4. If the command name does not specify a path, the shell attempts to match the command name against the list of internal shell commands. If a match is found, the internal command executes. Otherwise, the shell continues to step 5.
5. If the command name specifies a path, the shell searches the specified path for an executable file matching the command name. If a match is found, the external command (the executable file) executes. If no match is found, the shell reports an error and command processing completes.
6. If the command name does not specify a path, the shell searches the current directory for an executable file matching the command name. If a match is found, the external command (the executable file) executes. If no match is found, the shell continues to step 7.
7. The shell now searches each directory specified by the PATH environment variable, in the order listed, for an executable file matching the command name. If a match is found, the external command (the executable file) executes. If no match is found, the shell reports an error and command processing completes.

This example omits the path and file extension:

C:\>edit

To execute this command, the shell searches the current directory and then each directory in the search path. Assuming that the PATHEXT variable contains .COM;.EXE;.BAT;.CMD, each directory is searched for EDIT.COM, EDIT.EXE, EDIT.BAT and EDIT.CMD before the shell moves on to the next search directory.

Once the command shell resolves the command name either to an internal command or an external executable file, it executes the command as follows:
* If the command is internal, the shell executes it directly.
* If the command is a 16-bit or 32-bit Windows GUI executable program, the shell runs the program but does not wait for the command to complete.
* If the command is a 32-bit console application, or a 16-bit MS-DOS application, the shell runs the command in the current console window and waits for the command to complete.
* If the command is a script file (.BAT or .CMD), the shell switches to script mode and begins executing the script.
* If the command is a document or data file name associated with an application, the shell executes the appropriate application. The shell applies the previous rules based upon the type of the application associated with the data or document file. See the following section for more information on file associations.

Command Prompt (Cmd.exe) Runs Files That Do Not Have Executable File Name Extensions
Microsoft Windows XP - Start
CreateProcess Function (Windows)

Припоздал .

Последний раз редактировалось Iska, 02-05-2011 в 22:22.

Это сообщение посчитали полезным следующие участники:

Отправлено: 22:17, 02-05-2011 | #15