Welcome!

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

SignUp Now!

Where am I going wrong with ALIAS???

May
855
0
Not having used the "Alias" command much, I decided to use it more because it could, as is its main purpose, save me some typing. However, I have been totally unsuccessful in getting any of my new aliases to work correctly. Here's a sample test alias I made:

Ac*tualFiles=D:\DOS\StartX ActualFiles

Here's the full content of D:\DOS\StartX.bat (it's a batch rather than .btm file purely for testing purposes):

@Echo %1 %2 %3 %4 %5 %6 %7 %8 %9

And here's the result:

D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
EchoArgs
D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
EchoArgs
D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
EchoArgs

displayed over and over and over again in an infinite loop. All of my other aliases result in a variation on the same theme (only differing in the name of the batch file that is being invoked and possibly the parameter(s) that are being used), all of which batch files, for testing purposes, have the same content as the above. I must admit I am totally bamboozled at this point...
 
Ac*tualFiles=D:\DOS\StartX ActualFiles
The problem is with the alias, not the batch file. The alias appears to be self-referential, calling itself after calling the StartX batch file. Changing it to the following should fix it.
Code:
Ac*tualFiles=D:\DOS\StartX
 
It would seem there's something you're not telling us. Where did EchoArgs come
from? Anyway, it works OK for me:

Code:
v:\> type startx.bat
@Echo %1 %2 %3 %4 %5 %6 %7 %8 %9

v:\> alias actualfiles
v:\StartX ActualFiles

v:\> actualfiles
ActualFiles

On Sat, 12 Mar 2011 23:32:43 -0500, mathewsdw <> wrote:

|Not having used the "Alias" command much, I decided to use it more because it could, as is its main purpose, save me some typing. However, I have been *totally* unsuccessful in getting *any* of my new aliases to work correctly. Here's a sample test alias I made:
|
|Ac*tualFiles=D:\DOS\StartX ActualFiles
|
|Here's the full content of D:\DOS\StartX.bat (it's a batch rather than .btm file purely for testing purposes):
|
|@Echo %1 %2 %3 %4 %5 %6 %7 %8 %9
|
|And here's the result:
|
|D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
|EchoArgs
|D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
|EchoArgs
|D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
|EchoArgs
|
|displayed over and over and over again in an infinite loop. All of my other aliases result in a variation on the same theme (only differing in the name of the batch file that is being invoked and possibly the parameter(s) that are being used), all of which batch files, for testing purposes, have the same content as the above. I must admit I am totally bamboozled at this point...
 
It would seem there's something you're not telling us. Where did EchoArgs come from? Anyway, it works OK for me:

Code:
v:\> type startx.bat
@Echo %1 %2 %3 %4 %5 %6 %7 %8 %9

v:\> alias actualfiles
v:\StartX ActualFiles

v:\> actualfiles
ActualFiles
[/QUOTE]Vince, clearly you are a night-owl like me. But to answer your question, I don't have a [B]clue[/B] where that "EchoArgs" was coming from since it was [B]not[/B] in the StartX batch file that I was using, and I previously copied and pasted the contents of that file [B]exactly[/B] as it was to this thread, with no editing/formatting/exclusions/inclusions whatsoever.  However, I found and fixed the original problem.  In the original alias file, I had lines that were similar to this:
[CODE]Ali*s=D:\DOS\StartX [I]parameters[/I]
If I changed those aliases to something like this:
Code:
Ali*s=Start D:\DOS\StartX [I]parameters[/I]
I got it mostly working. I don't really understand why I needed a "Start" command to run a batch file, but I really don't care that much as long as things are working. However, there was one "Alias" line that caused "piping" to stop working altogether if that line was in the loaded "Alias" file. That line was:
Code:
Fin*dSong=Start D:\DOS\StartX FindSong
if that line was in the loaded "Alias" file, the result of
Code:
dir | Find "Alias"
was:
Code:
TCC: (Sys) The system cannot find the file specified.
 "D:\DOS\StartX"
which was really odd given that there was a "StartX.btm" file (the contents of which I showed previously) in the "D:\DOS" directory and I was not even referring to it (directly or indirectly) in the command sequence. (I was using that piping sequence purely for testing purposes; I found that piping was not working altogether when trying to use it in an actually-useful way.) If that line was NOT in the loaded alias file, the result of the previous command sequence was:
Code:
 3/13/2011   0:00           3,078  Alias-1.txt
 3/12/2011  23:54           3,079  Alias-2.txt
 3/12/2011  23:01           2,981  Alias-3.txt
 3/13/2011   0:35           3,466  Alias.txt
 3/13/2011   3:01           1,853  GoodAlias.txt
which was exactly what it should have been. The really odd thing was that that line, as far as I could tell, was exactly like a fair number of other lines in the loaded alias file (the "StartX" batch file is a batch-file consolidator where I place a fair number of processes in one single batch file rather than having dozens of rather small batch files), differing only in the name of the alias and, of course, the parameters that were being passed to the StartX batch file. The simple truth is that I can live without that particular alias; I mention it primarily not to leave you (and any one else who reads these posts) "hanging" and also because it is a real mystery to me that is worth pursuing mostly out of intellectual curiosity. - Dan
 
On Sun, 13 Mar 2011 05:00:28 -0400, mathewsdw <> wrote:

|Code:
|---------
|Fin*dSong=Start D:\DOS\StartX FindSong
|---------
|if the line is in the loaded "Alias" file, the result of
|Code:
|---------
|dir | Find "Alias"
|---------
| is:
|Code:
|---------
|TCC: (Sys) The system cannot find the file specified.
| "D:\DOS\StartX"
|---------

That one is OK here also, doing what I'd expect it to do.

Code:
v:\> type startx.bat
@Echo %1 %2 %3 %4 %5 %6 %7 %8 %9

v:\> alias | grepp FindS
Fin*dSong=v:\StartX FindSong

v:\> dir | find "Alias"
FindSong "Alias"
 
On Sun, 13 Mar 2011 05:00:28 -0400, mathewsdw <> wrote:

|Code:
|---------
|Fin*dSong=Start D:\DOS\StartX FindSong
|---------
|if the line is in the loaded "Alias" file, the result of
|Code:
|---------
|dir | Find "Alias"
|---------
| is:
|Code:
|---------
|TCC: (Sys) The system cannot find the file specified.
| "D:\DOS\StartX"
|---------

That one is OK here also, doing what I'd expect it to do.

Code:
v:\> type startx.bat
@Echo %1 %2 %3 %4 %5 %6 %7 %8 %9

v:\> alias | grepp FindS
Fin*dSong=v:\StartX FindSong

v:\> dir | find "Alias"
FindSong "Alias"
Vince, I just clarified my previous posting, you might want to re-read it. However, I stand by my issue that that does not work for me (I just now tried it again), but maybe it's a mute point by now...
 
Works for me:

C:\Junk>alias Ac*tualFiles=c:\junk\StartX ActualFiles

C:\Junk>ac
ActualFiles

C:\Junk>actualfiles
ActualFiles

C:\Junk>type StartX.bat
@Echo %1 %2 %3 %4 %5 %6 %7 %8 %9

C:\Junk>

TCC 12.01.44 Windows Vista [Version 6.0.6002]
 
Works for me:

C:\Junk>alias Ac*tualFiles=c:\junk\StartX ActualFiles

C:\Junk>ac
ActualFiles

C:\Junk>actualfiles
ActualFiles

C:\Junk>type StartX.bat
@Echo %1 %2 %3 %4 %5 %6 %7 %8 %9

C:\Junk>

TCC 12.01.44 Windows Vista [Version 6.0.6002]
Thanks! I tried a number of things and I'm not sure what fixed it (bad memory again; it's getting almost critical), but something fixed it. I wish I could be more specific, but it is no longer a problem (which is the important thing)....
 
Back
Top
[FOX] Ultimate Translator
Translate