1

hello I recently used a script to try to give my bat file it's own specific name, but instead it turned out to just create this error message:

"The system cannot find message text for message number 0x2350 in the message file for Application"

So how do I reset this?

Here's the command that i followed:

        echo off
set program=c:\Windows\system32\cmd.exe
set alias_name=%1
set alias_path=%~dp0
set batch_file=%2
set alias=%alias_path%%alias_name%.exe
call :find_args %*
call :make_link %program% %alias%
%alias% /C %batch_file% %args%
:find_args
set args=
shift
shift
:loop
  if [%1] == [] goto :eof
  set args=%args% %1
  shift
  goto :loop
:make_link
  copy %1 %2

So please Help me!

(also heres a direct link to the website [Change process name when launched as batch file

Compo
  • 36,585
  • 5
  • 27
  • 39
  • I'm going to suggest that `%alias% /C ...` should probably be `%program% /C ...` – Compo Jan 11 '20 at 15:20
  • The command line `set program=c:\Windows\system32\cmd.exe` is not needed at all. There is predefined the environment variable `ComSpec` which is an extremely important environment variable and which has as value the full qualified file name of the Windows command processor. – Mofi Jan 11 '20 at 16:35
  • `set alias_name=%1` should be written as `set "alias_name=%~1"` and the string value of `alias_name` should be referenced with `"%alias_name%"`. Run in a command prompt window `call /?` to get knowledge about the difference on using `%1` and `%~1`. See also: [Why is no string output with 'echo %var%' after using 'set var = text' on command line?](https://stackoverflow.com/a/26388460/3074564) – Mofi Jan 11 '20 at 16:38
  • `set alias_path=%~dp0` should be written as `set "alias_path=%~dp0"` to work also correct if the batch file is stored for example in the directory `C:\Temp\Development & Testing`. It is of course advisable to write next line with `set "batch_file=%~2"` and next but one line `set "alias=%alias_path%%alias_name%.exe"`. – Mofi Jan 11 '20 at 16:41
  • `if [%1] == [] goto :eof` is not good. It would be better to use `if "%~1" == "" goto :EOF`. See also: [What is the difference between “…” and x“…” in an IF condition in a Windows batch file?](https://stackoverflow.com/questions/52414721/) The square brackets have no special meaning for Windows command processor, but `"` has a special meaning as explained by help output on running in a command prompt window `cmd /?`. – Mofi Jan 11 '20 at 16:45
  • What is the so much white space beside echo off and no @ symbol. Regarding the code quality although is not good. – Wasif Jan 11 '20 at 16:58
  • There must be `goto :eof` before `:find_args` in order not to unintentionally continue execution there... – aschipfl Jan 12 '20 at 07:02
  • Are you wanting to change cmd.exe window title? – Wasif Jan 13 '20 at 08:02

0 Answers0