Q on Set command format

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Jc_oz
Posts: 8
Joined: 27 Aug 2009 11:03

Q on Set command format

#1 Post by Jc_oz » 30 Aug 2009 08:57

Hi, just a quick question.

I have a script which I am using the set statement.

alpha is a variable that has been previously set but for some reason the following does not work.

Code: Select all

&&set "alpha=%fname:~-1!%"

All I want is the the last digit of "fname" (also a variable set earlier) to be assigned to "alpha"

I can't understand why it does not work....

Thanks for any suggestions

Regards,

John

DccD
Posts: 23
Joined: 26 Aug 2009 19:34

#2 Post by DccD » 30 Aug 2009 19:55

I'm not sure why you put the excalamation (!) but this should work:

Code: Select all

set "alpha=%fname:~-1%"

Post Reply