This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with user commands

Hi all,

I want to use a user command to post-process the axf file. I enclose the command in quotes to preserve spaces in the path. However, if I also use quotes to enclose parameters in quotes, then the external command does not get called. If I don't enclose the parameters in quotes, the external command is called but the parameter is not parsed correctly.

As an example, a batch file called test_cmd.bat:

echo Parameter 1 = %1
echo Parameter 2 = %2

If I call this using

"C:\nXDS\nXDS Interface Processor\Application\Release\test_cmd.bat" #L

I get

User command #2: "C:\nXDS\nXDS Interface Processor\Application\Release\test_cmd.bat" C:/nXDS/nXDS Interface Processor/Application/Release/Obj/nXDS.axf
C:\nXDS\nXDS Interface Processor\Application>echo Parameter 1 = C:/nXDS/nXDS
Parameter 1 = C:/nXDS/nXDS
C:\nXDS\nXDS Interface Processor\Application>echo Parameter 2 = Interface
Parameter 2 = Interface
".\Release\Obj\nXDS.axf" - 0 Error(s), 0 Warning(s).

The batch file is called but the parameter is split by the spaces.

If I call using

"C:\nXDS\nXDS Interface Processor\Application\Release\test_cmd.bat" "#L"

I get

User command #2: "C:\nXDS\nXDS Interface Processor\Application\Release\test_cmd.bat" "C:/nXDS/nXDS Interface Processor/Application/Release/Obj/nXDS.axf"
--- Error: User Command terminated, Exit-Code = 1
".\Release\Obj\nXDS.axf" - 1 Error(s), 0 Warning(s).

The batch file does not appear to have been called when both the command and parameter are in quotes.

Apart from the obvious workaround of not using a path containing spaces, is there any solution for this problem?

Regards

Parents Reply Children
  • "it does not do command but it does do cmd"

    Yes, of course it does. But I wasn't talking about the newer "cmd" but about the "command.com" alternative.

    The difference between the win32 application "cmd" (cmd.exe) and the 16-bit program "command" (command.com) is important for this discussion. The "command" prompt makes use of 8.3-based file and directory names, which can be valuable if you need to quickly jump around on the hard drive and find out suitable path names to use for some ancient win16 or MS-DOS program.

    I never bothered with Vista, but command.com was available at least up to Win XP, in which case "c:\Documents and Settings\" would become "C:\DOCUME~1\" for compatibility.

  • <QUOTE>The "command" prompt makes use of 8.3-based file and directory names, which can be valuable if you need to quickly jump around on the hard drive and find out suitable path names to use for some ancient win16 or MS-DOS program.</QUOTE>

    have you ever tried opening cmd.exe and typing:

    dir /X
    

    ???

    you can type in the short name as a parameter too

    works in win7

    always yo're freind

    Zeusti.