strange error in alias

Status
Not open for further replies.
Aug 31, 2011
5
0
#1
OS: Vista Home Premium 64bit

C:\Windows\System32]alias kill 'c:\windows\system32\taskkill.exe /im %1 /t /f'

[C:\Windows\System32]kill
TCC: Unknown command "'c:\windows\system32\taskkill.exe"

taskkill is a Vista command, and when I try to create an alias called "kill" to invoke the command, I get the above error. I can type "taskkill" at the command prompt and I get the usual info about the command, but when I try to use the alias it's as if the taskkill command isn't found
 
Jun 2, 2008
296
1
#2
OS: Vista Home Premium 64bit

C:\Windows\System32]alias kill 'c:\windows\system32\taskkill.exe /im %1 /t /f'

[C:\Windows\System32]kill
TCC: Unknown command "'c:\windows\system32\taskkill.exe"

taskkill is a Vista command, and when I try to create an alias called "kill" to invoke the command, I get the above error. I can type "taskkill" at the command prompt and I get the usual info about the command, but when I try to use the alias it's as if the taskkill command isn't found
I think what you're seeing is the result of the redirection in 64bit Windows. See Rex's response in this thread:

http://jpsoft.com/forums/support/3373-different-results-between-tcmd-cmd.html
 
Aug 31, 2011
5
0
#3
Sorry, I guess I should have stated that I am running TCMD 64-bit.

Interestingly, if I put the same text into a btm file, it works fine. It seems that only the alias won't work.

Tom
 
Aug 31, 2011
5
0
#5
Oh.. it's the single quotes you have around everything. Remove them and it should work fine.
[C:\Program Files\JPSoft\TCMD13x64]alias kill taskkill.exe /im %1 /t /f

[C:\Program Files\JPSoft\TCMD13x64]kill deskpins.exe
ERROR: Invalid syntax. Value expected for '/im'.
Type "TASKKILL /?" for usage.
 
Jun 2, 2008
296
1
#6
[C:\Program Files\JPSoft\TCMD13x64]alias kill taskkill.exe /im %1 /t /f

[C:\Program Files\JPSoft\TCMD13x64]kill deskpins.exe
ERROR: Invalid syntax. Value expected for '/im'.
Type "TASKKILL /?" for usage.
Ok, you've got it running. :) But when you pass it the /im switch, it expects it to be followed by a value. Even without being in a alias, taskkill /im will give you the same error. It's when you run it without any parameters that it spits out the help.
 
Aug 31, 2011
5
0
#7
Ok, you've got it running. :) But when you pass it the /im switch, it expects it to be followed by a value. Even without being in a alias, taskkill /im will give you the same error. It's when you run it without any parameters that it spits out the help.
The strange thing is, the %1 that I define into the alias is not stored. If I print out the alias the %1 is gone, so how do I pass a parameter to an alias on the command line?

I want to "kill deskpins.exe" but when I type it as a command, the alias doesn't contain the %1 so there's no place for the parameter to get passed.

[C:\Program Files\JPSoft\TCMD13x64]alias kill taskkill /im %1 /t /f

[C:\Program Files\JPSoft\TCMD13x64]alias kill
taskkill /im /t /f

notice the missing %1
 
Jun 2, 2008
296
1
#8
The strange thing is, the %1 that I define into the alias is not stored. If I print out the alias the %1 is gone, so how do I pass a parameter to an alias on the command line?

I want to "kill deskpins.exe" but when I type it as a command, the alias doesn't contain the %1 so there's no place for the parameter to get passed.
Ah.. ok, that helps me understand what else I missed. Double up the percent like so:

alias kill c:\windows\system32\taskkill.exe /im %%1 /t /f
 
May 29, 2008
36
0
#9
> I want to "kill deskpins.exe" but when I type it as a command, the alias
> doesn't contain the %1 so there's no place for the parameter to get passed.
>
You need to surround the alias with back quotes when you create it so that no
expansion or substitution is done until the alias is run:

alias kill `c:\windows\system32\taskkill.exe /im %1 /t /f`
 
Status
Not open for further replies.