MCT Posted January 2, 2005 Posted January 2, 2005 ive got this code <snip>[CDImage]HKCR,"Folder\shell\MakeBootISO\command",,,"CDIMAGE.EXE -L"%here%" -h -j1 -m -o -B%11%\xpBoot.img %here% %target%"HKCR,"Folder\shell\MakeDataISO\command",,,"CDIMAGE.EXE -L"%here%" -YD -N -H -X -o -m -D %here% %target%"[Strings]here = """%1"""target = """%1.iso"""it works, but how can i get the LABEL (-l) to show the name of the directory without the full path ? like current label is "G:\nLite XP" but i only want it to say "nLite XP"
prathapml Posted January 2, 2005 Posted January 2, 2005 Yep, I get what you mean.I'll put out a basic idea here, Alanoll knows this sort of a thing better....The "CD" command will echo back the full path of where you are. There's some way to select only desired characters from the output (as in where you do "CD ~0,1" to select only the drive letter). So there has to be some way, to select only characters that start from the last position of slash, and pipe the output to a variable. After that, you can use that variable as your label (Eg: -l"%dirname%").
Bâshrat the Sneaky Posted January 2, 2005 Posted January 2, 2005 (edited) It's indeed something like that! Darn, saw it somewhere a week or so ago... Trying to find it back....EDIT: May also specify substrings for an expansion. %PATH:~10,5%would expand the PATH environment variable, and then use only the 5 characters that begin at the 11th (offset 10) character of the expanded result. If the length is not specified, then it defaults to the remainder of the variable value. If either number (offset or length) is negative, then the number used is the length of the environment variable value added to the offset or length specified. %PATH:~-10%would extract the last 10 characters of the PATH variable. %PATH:~0,-2%would extract all but the last 2 characters of the PATH variable.So you need everything after X:\, so after the third character. Then I guess it would be %variable:~0,3% Edited January 2, 2005 by Bâshrat the Sneaky
Yzöwl Posted January 2, 2005 Posted January 2, 2005 Well in that case would it not be %CD:~3% i.e. no length just offset 3?Anyhow, would the above only be effective if you CD to the directory first, and would the right click command only work on files located 1 level below root.
Tsunami Posted January 2, 2005 Posted January 2, 2005 He wants the directory name, so he needs everything after the last \, not everything after X:\.
Yzöwl Posted January 2, 2005 Posted January 2, 2005 @TsunamiI think that's what I was trying to get around to.It would of course be a lot simpler if it was possible to expand out %1 somehow
jdoe Posted January 2, 2005 Posted January 2, 2005 I thought we couldn't put spaces in label name.I'm not sure how your INF work but if you pass %1 argument somewhere, then you can get what you want with %~n1 (extract only last name of path)Type FOR /? at command prompt for more details.
Yzöwl Posted January 3, 2005 Posted January 3, 2005 (edited) If the %1 is already stored, which it must be in order for the inf to run using it, then just creating a label="""%~n1""" string and changing the first %here% in each of the two keys may do it then!I would have suggested this in my last post, but thought that the ~n expanded the filename, which of course we don't have cos we're right clicking a folder. Whereas ~p gave the path and ~d the drive letter etc.[EDIT]Tested it as above, it gives %~N1 as the LABEL[/EDIT] Edited January 3, 2005 by Yzöwl
MCT Posted January 3, 2005 Author Posted January 3, 2005 ive tried all suggestions, any more help? i cant get it 2 work
RyanVM Posted January 3, 2005 Posted January 3, 2005 C:\Documents and Settings\Administrator>echo %CD:~3%Documents and Settings\AdministratorLooks like it works to me...EDIT: Nevermind, I misunderstood. I was never able to figure out a way to use system environment variables within INF files. I attempted that in the early days of my update pack when I was trying to put the date in the registry. I ended up giving up and added the entries with a batch file instead.
MCT Posted January 3, 2005 Author Posted January 3, 2005 ive tried with that too, [CDImage]HKCR,"Folder\shell\MakeBootISO\command",,,"CDIMAGE.EXE -L"%label%" -h -j1 -m -o -B%11%\xpBoot.img %here% %target%"HKCR,"Folder\shell\MakeDataISO\command",,,"CDIMAGE.EXE -LDATA -YD -N -H -X -O -M -D %here% %target%"[Strings]here = """%1"""target = """%1.iso"""label = """%1:~3%"""returnsG:\nlite XP~3
Alanoll Posted January 3, 2005 Posted January 3, 2005 to be quite honest, i don't know. But i do know that all of the above won't work the %~n3 or whatever, won't work as that's for CMD PROMPT interpreter, and not the INF intepreter. Nor would any of the other commands involving the ~. However... I can create a workaround for when importing, but otherwise...What you could do instead, is call a CMD file upon right clicking, in which you can use the ~.The problem here is that, you can't do any fancy INF stuff, as it's the registry and rundll i believe that interprets the parameters. I could be wrong, and it is the COMMAND interpreter but never really looked into it I don't think the registry is capable of ~
MCT Posted January 3, 2005 Author Posted January 3, 2005 so what would the cmd file look like? cuz i havent the slightest clue on how 2 send info from inf to cmd ?
Alanoll Posted January 3, 2005 Posted January 3, 2005 well, technically, you're sending info from the Registry to the CMD file.CDIMAGE.EXE -L"%1:~3%" -h -j1 -m -o -B%systemroot%\system32\xpBoot.img "%1" "%1.iso"The in the INF[CDImage]HKCR,"Folder\shell\MakeBootISO\command",,,"%11%\cdimage.cmd """%1""""
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now