Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: building complex cmd on one line  (Read 3588 times)

0 Members and 1 Guest are viewing this topic.

michael sorens

  • Guest
building complex cmd on one line
« on: November 18, 2004, 09:47:00 AM »
I want to build then execute a command in one line at a DOS prompt (i.e. storing in doskey, not a batch file).
The command will take a parameter from the command-line (i.e. %1).
The command will use the current directory (i.e. %CD%).

Here is what I want to do in multiple lines:
set varA=%CD:src=bin%
rem varA might now contain something like \usr\ms\devel\bin-test\com\cleancode\jdbc
rem Not sure about the next step. I want to truncate varA from \com onward,
where the stuff following \com may vary. Effectively:
set varB=\usr\ms\devel\bin-test
rem Then finally invoke this command:
javac -d %varB% %1

merlin_2

  • Guest
Re: building complex cmd on one line
« Reply #1 on: November 19, 2004, 05:04:34 PM »

michael sorens

  • Guest
Re: building complex cmd on one line
« Reply #2 on: November 22, 2004, 08:00:15 AM »
Thank you for your reply. I will infer from your terse reply that you are suggesting Doskey as an answer. It is not. I already use Doskey extensively. Doskey is useful once one has the command sequence in hand, which I do not.

MalikTous

  • Guest
Re: building complex cmd on one line
« Reply #3 on: November 23, 2004, 11:37:29 AM »
Including your prompt, you can make a command line of up to 255 characters, I think the limit is.

You may wish to build a batch file with replaceable parameters (%1, %2, %3, %4, %5) and issue that instead.

michael sorens

  • Guest
Re: building complex cmd on one line
« Reply #4 on: November 24, 2004, 09:30:29 AM »
Let me restate the key points that have been missed by replies so far:
First, I want to create a one-line command (see subject line:-) using pipes, etc. -- not a batch file (reason: I want to ultimately just create a doskey definition).
Second, I need to know how to set the value for varB from varA as discussed in my example, using some combination of DOS commands.


MalikTous

  • Guest
Re: building complex cmd on one line
« Reply #5 on: November 24, 2004, 01:38:50 PM »
if %vara% == "string1" set varb = string2

You may end up needing to set the command up with both a DOSKEY macro and an associated batch file...
« Last Edit: November 24, 2004, 01:39:21 PM by MalikTous »

michael sorens

  • Guest
Re: building complex cmd on one line
« Reply #6 on: November 26, 2004, 11:34:36 AM »
I repeat my original requirement:
"varA might now contain something like \usr\ms\devel\bin-test\com\cleancode\jdbc. I then want to truncate varA from '\com' onward,
where the stuff following \com may vary [and put into varB]..."

So can this be done in DOS batch language or not?