Can I use an environment variable as a button parameter?
Moderators: white, Hacker, petermad, Stefan2
Can I use an environment variable as a button parameter?
How can I use an environment variable instead of a particular full path as a button parameter?
For example, I'd like to have %APPDATA% instead of C:\Users\UserName\AppData\Roaming\ or %HOMEDRIVE%%HOMEPATH% instead of C:\Users\UserName etc
The above obviously won't work (otherwise I wouldn't ask this question), but I'm not sure why exactly. So, what would be the right way?
Thank you!
For example, I'd like to have %APPDATA% instead of C:\Users\UserName\AppData\Roaming\ or %HOMEDRIVE%%HOMEPATH% instead of C:\Users\UserName etc
The above obviously won't work (otherwise I wouldn't ask this question), but I'm not sure why exactly. So, what would be the right way?
Thank you!
Double all percent characters if you use environment variables in the parameter field of a button or the TC start menu. Strings like %C are special variables resolved by TC itself, see TC help for more details (press F1 in "Change button bar" dialog).
Regards
Dalai
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
I'm sorry l'm not sure what "Change button bar" dialog you are referring to. Can you tell me please, where exactly in the help file I can read about it? Or are there several of them? And unfortunately doubling percents doesn't do anything. And BTW, I'm using cd command (in case it's a wrong one for this).Dalai wrote:Double all percent characters if you use environment variables in the parameter field of a button or the TC start menu. Strings like %C are special variables resolved by TC itself, see TC help for more details (press F1 in "Change button bar" dialog).
Regards
Dalai
Thank you.
UPDATE
Oh I see, you probably meant "change single button". Thanks.
Right-click on free space on the button bar and select "Change...". But the "Change single button" dialog also works, of course.Ahu_Lee wrote:I'm sorry l'm not sure what "Change button bar" dialog you are referring to.
Make the button like this:And unfortunately doubling percents doesn't do anything. And BTW, I'm using cd command (in case it's a wrong one for this).
Code: Select all
TOTALCMD#BAR#DATA
cd %HOMEDRIVE%%HOMEPATH%
shell32.dll
-1
You can copy the code above and right-click on some free space on you button bar and select "Paste" to create a new button from it.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
2Ahu_Lee
It is only in the "Parameters:" field that you have to use double % signs - not in the "Command" field
It is only in the "Parameters:" field that you have to use double % signs - not in the "Command" field
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
-
- Junior Member
- Posts: 52
- Joined: 2006-10-23, 09:46 UTC
Sorry, same question. This doesn't work with %AppDATA%:
Command : C:\Program Files (x86)\Notepad++\notepad++.exe
Parameter : %APPDATA%\Roaming\ghisler\wincmd.ini
Path : C:\Program Files (x86)\Notepad++\
I've tried with %%AppDATA%% too.
Is it possible to use a variable in the parameter field, or do I have to enter the full path?
Thanks.
Command : C:\Program Files (x86)\Notepad++\notepad++.exe
Parameter : %APPDATA%\Roaming\ghisler\wincmd.ini
Path : C:\Program Files (x86)\Notepad++\
I've tried with %%AppDATA%% too.
Is it possible to use a variable in the parameter field, or do I have to enter the full path?
Thanks.
2DjobyDjoba
Command : C:\Program Files (x86)\Notepad++\notepad++.exe %APPDATA%\ghisler\wincmd.ini
Parameter :
Path :
Also check in a DOS-Box the command
[face=comicsansms]set app[/face]
to see %AppData% already points to the Roaming folder.
- - - Update to show issue with NP++
NotePad++ Button does not work:
Comm: C:\Program Files\NotePad++ TEST\notepad++.exe
Param: %%AppData%%\GHISLER - Leerzeichen\WINCMD.INI
NotePad++ In DOS-Box works:
C:\>C:\Program Files\NotePad++ TEST\notepad++.exe %AppData%\GHISLER - Leerzeichen\WINCMD.INI
NotePad++ Button works:
Comm: C:\Program Files\NotePad++ TEST\notepad++.exe %AppData%\GHISLER - Leerzeichen\WINCMD.INI
Notepad2 Button works fine:
Comm: C:\Program Files\NotePad++ TEST\notepad2.exe
Param: %%AppData%%\GHISLER - Leerzeichen\WINCMD.INI
That was just an quick test with an very old NP++
Command : C:\Program Files (x86)\Notepad++\notepad++.exe %APPDATA%\ghisler\wincmd.ini
Parameter :
Path :
Also check in a DOS-Box the command
[face=comicsansms]set app[/face]
to see %AppData% already points to the Roaming folder.
- - - Update to show issue with NP++
NotePad++ Button does not work:
Comm: C:\Program Files\NotePad++ TEST\notepad++.exe
Param: %%AppData%%\GHISLER - Leerzeichen\WINCMD.INI
NotePad++ In DOS-Box works:
C:\>C:\Program Files\NotePad++ TEST\notepad++.exe %AppData%\GHISLER - Leerzeichen\WINCMD.INI
NotePad++ Button works:
Comm: C:\Program Files\NotePad++ TEST\notepad++.exe %AppData%\GHISLER - Leerzeichen\WINCMD.INI
Notepad2 Button works fine:
Comm: C:\Program Files\NotePad++ TEST\notepad2.exe
Param: %%AppData%%\GHISLER - Leerzeichen\WINCMD.INI
That was just an quick test with an very old NP++
Last edited by Stefan2 on 2017-08-12, 13:25 UTC, edited 1 time in total.
-
- Junior Member
- Posts: 52
- Joined: 2006-10-23, 09:46 UTC
Thanks guys!
@HolgerK, Thanks, I will stick with this one!
Have a nice day!
Oups... typoHacker wrote:%APPDATA% already contains \Roaming\.
Indeed, issue with NP++ here! Doesn't like the parameter.Stefan2 wrote:- - - Update to show issue with NP++
NotePad++ Button does not work:
Comm: C:\Program Files\NotePad++ TEST\notepad++.exe
Param: %%AppData%%\GHISLER - Leerzeichen\WINCMD.INI
@HolgerK, Thanks, I will stick with this one!
Have a nice day!