# unexpected %1 while starting ide

#### fbdirks

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.

#### Steve Fabian

| 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

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.

#### Jim Cook

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.

#### Charles Dye

##### Super Moderator
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.)

#### Jim Cook

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.

#### rconn

> Whenever I run this script (for example: makescript test.btm) the Ide
> starts with the filename %1 - literally

WAD -- IDE does not expand any arguments, because that would break
subsequent execution of the batch file. When the batch file is executed
within the IDE, the arguments are expanded.

Rex Conn
JP Software

Replies
0
Views
136
Replies
7
Views
246
Replies
1
Views
537
Replies
0
Views
620
Replies
2
Views
1K
Replies
10
Views
2K
Replies
10
Views
3K
Replies
13
Views
2K
Replies
4
Views
2K
Replies
7
Views
1K
Replies
8
Views
1K
Replies
6
Views
2K
Replies
26
Views
4K
Replies
17
Views
3K
Replies
6
Views
3K
Replies
30
Views
9K
Replies
0
Views
3K
Replies
0
Views
3K
Replies
10
Views
903
Replies
6
Views
1K
Replies
3
Views
1K
Replies
4
Views
2K
Replies
3
Views
2K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
7
Views
2K
Replies
3
Views
1K
Replies
12
Views
3K
M
Replies
1
Views
3K
Replies
0
Views
2K
B
Replies
2
Views
3K
Replies
5
Views
370
Replies
2
Views
516
Replies
3
Views
838
Replies
34
Views
4K
Replies
2
Views
1K
Replies
8
Views
2K
Replies
13
Views
2K
Replies
3
Views
2K
Replies
1
Views
2K
Replies
4
Views
2K
Replies
4
Views
2K
Replies
2
Views
1K
Replies
9
Views
2K
Replies
10
Views
7K
Replies
2
Views
2K
Replies
6
Views
2K
Replies
1
Views
2K
Replies
14
Views
3K
Replies
4
Views
2K