|
Answer» 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 http://www.ss64.com/nt/doskey.htmlThank 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. 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.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.
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...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?
|