Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

unexpected %1 while starting ide

Mar
1
0
Hi,

this could be a typical newbie problem. I only recently became hooked again on TC after 10 years of commandline abstinence - so to speak. I feel a little bit rusty.

My idea was to make a script (in the \scripts directory that is in the path) that enables me to write a new script in that directory regardless of the directory i am in at that moment. This is the (simple) script I wrote:

rem --makescript.btm--
@echo off
pushd
cdd %_DISK:\scripts
ide /C %1
popd


Whenever I run this script (for example: makescript test.btm) the Ide starts with the filename %1 - literally! When i change the editor in the script like this:

@echo off
pushd
cdd %_DISK:\scripts
ue /C %1
popd

(where ue is an alias that starts up UltraEdit)

UltraEdit starts up with the filename that is provided in the first parameter (test.btm in the example), not %1. This - for me - is the expected behaviour.

What am i missing?

.feike.
 
| My idea was to make a script (in the \scripts directory that is in
| the path) that enables me to write a new script in that directory
| regardless of the directory i am in at that moment. This is the
| (simple) script I wrote:
|
| rem --makescript.btm--
| @echo off
| pushd
| cdd %_DISK:\scripts
| ide /C %1
| popd
|
|
| Whenever I run this script (for example: makescript test.btm) the
| Ide starts with the filename %1 - literally! When i change the
| editor in the script like this:
|
| @echo off
| pushd
| cdd %_DISK:\scripts
| ue /C %1
| popd
|
| (where ue is an alias that starts up UltraEdit)
|
| UltraEdit starts up with the filename that is provided in the first
| parameter (test.btm in the example), not %1. This - for me - is the
| expected behaviour.
|
| What am i missing?

I suspect there is a problem with IDE not parsing its commandline. There are
a couple of enhancements / generalizations possible for your batch program -
I use the UE version:

@echo off
pushd %@path[%_batchname]
ue %@if[isfile %1,,/C] %1
popd

This will work even if _disk is not the same drive as the one where \scripts
is located, and will put /C in the command line only if the file is new,
allowing the same program to either edit an existing file, or create a new
one.
--
Steve
 
In my testing here, when IDE is being invoked either at the command line or
in a batch file, it does not change % parameters on the command line.

On Tue, Mar 16, 2010 at 12:06 PM, Steve Fábián <>wrote:


> | My idea was to make a script (in the \scripts directory that is in
> | the path) that enables me to write a new script in that directory
> | regardless of the directory i am in at that moment. This is the
> | (simple) script I wrote:
> |
> | rem --makescript.btm--
> | @echo off
> | pushd
> | cdd %_DISK:\scripts
> | ide /C %1
> | popd
> |
> |
> | Whenever I run this script (for example: makescript test.btm) the
> | Ide starts with the filename %1 - literally! When i change the
> | editor in the script like this:
> |
> | @echo off
> | pushd
> | cdd %_DISK:\scripts
> | ue /C %1
> | popd
> |
> | (where ue is an alias that starts up UltraEdit)
> |
> | UltraEdit starts up with the filename that is provided in the first
> | parameter (test.btm in the example), not %1. This - for me - is the
> | expected behaviour.
> |
> | What am i missing?
>
> I suspect there is a problem with IDE not parsing its commandline. There
> are
> a couple of enhancements / generalizations possible for your batch program
> -
> I use the UE version:
>
> @echo off
> pushd %@path[%_batchname]
> ue %@if[isfile %1,,/C] %1
> popd
>
> This will work even if _disk is not the same drive as the one where
> \scripts
> is located, and will put /C in the command line only if the file is new,
> allowing the same program to either edit an existing file, or create a new
> one.
> --
> Steve
>
>
>
>
>



--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.
 
I worked around it by using two lines instead of your single IDE line:

set foo=ide /c %1
%foo


On Tue, Mar 16, 2010 at 11:30 AM, fbdirks <> wrote:


> Hi,
>
> this could be a typical newbie problem. I only recently became hooked again
> on TC after 10 years of commandline abstinence - so to speak. I feel a
> little bit rusty.
>
> My idea was to make a script (in the \scripts directory that is in the
> path) that enables me to write a new script in that directory regardless of
> the directory i am in at that moment. This is the (simple) script I wrote:
>
> rem --makescript.btm--
> @echo off
> pushd
> cdd %_DISK:\scripts
> ide /C %1
> popd
>
>
> Whenever I run this script (for example: makescript test.btm) the Ide
> starts with the filename %1 - literally! When i change the editor in the
> script like this:
>
> @echo off
> pushd
> cdd %_DISK:\scripts
> ue /C %1
> popd
>
> (where ue is an alias that starts up UltraEdit)
>
> UltraEdit starts up with the filename that is provided in the first
> parameter (test.btm in the example), not %1. This - for me - is the expected
> behaviour.
>
> What am i missing?
>
> .feike.
>
>
>
>
>



--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.
 
I suspect there is a problem with IDE not parsing its commandline.

Not a problem but a deliberate feature, I'm pretty sure. You would normally want variable references to be expanded by the secondary shell -- the one running the batch file to be debugged -- and not by the calling shell.

(And if I understand correctly, you should really be calling BDEBUGGER, not the undocumented IDE.)
 
IDE is documented:

Topic "bdebugger.htm" last edited 2009-07-30

Purpose: Calls the Take Command IDE / batch debugger (IDE.EXE).

Format: BDEBUGGER [/C] batchfilename [parameters]
or
IDE [/C] file...


On Tue, Mar 16, 2010 at 1:21 PM, Charles Dye <> wrote:


> ---Quote (Originally by Steve Fábián)---
> I suspect there is a problem with IDE not parsing its commandline.
> ---End Quote---
> Not a problem but a deliberate feature, I'm pretty sure. You would
> normally want variable references to be expanded by the secondary shell --
> the one running the batch file to be debugged -- and not by the calling
> shell.
>
> (And if I understand correctly, you should really be calling BDEBUGGER, not
> the undocumented IDE.)
>
>
>
>
>



--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.
 

Similar threads

Back
Top