Do it possible make a button to copy path as EnvVar?
f.e.
%ProgramFiles%\7-Zip\7z.exe
instead of
c:\Program Files\7-Zip\7z.exe.
or
%WinDir%\system32\SearchIndexer.exe
instead of
c:\WINDOWS\system32\SearchIndexer.exe
EnvVar path
Moderators: petermad, Stefan2, Hacker
Re: EnvVar path
You have to create a script/pgm for it it.
See a sample in C#, you can adapt it to other language. Even you can add this as a field in WinScriptAdv. Reuse it for a custom view or direct call.
See a sample in C#, you can adapt it to other language. Even you can add this as a field in WinScriptAdv. Reuse it for a custom view or direct call.
Re: EnvVar path
2Hurdet
Drag .vbs to the button bar from the TC script subfolder and specify the required parameters.
My old script:
Code: Select all
'——————————————————————————————— VBS ———————————————————————————————
' Copy the full names of selected objects with environment variables
' Parameters: %Z%WL [/dq]
' Note: /dq adds double quotes if there are spaces in the path
'———————————————————————————————— Author: Flasher (22.01.2018) © ———
Option Explicit
Dim List, oDic, F, i, Keys, QM, oList, K, All
If WSH.Arguments.Count Then List = WSH.Arguments(0) Else WSH.Quit
If WSH.Arguments.Named.Exists("dq") Then QM = """"
Set oDic = CreateObject("Scripting.Dictionary")
oDic.CompareMode = 1
With CreateObject("WScript.Shell").Environment("Process")
For Each F in Split("COMMANDER_INI COMMANDER_PATH COMMONPROGRAMW6432 " &_
"COMMONPROGRAMFILES(x86) COMMONPROGRAMFILES PUBLIC PROGRAMFILES(x86) " &_
"PROGRAMW6432 PROGRAMFILES WINDIR TMP TEMP LOCALAPPDATA APPDATA " &_
" USERPROFILE ALLUSERSPROFILE COMMANDER_DRIVE SYSTEMDRIVE HOMEDRIVE")
i = .Item(F)
If i <> "" Then If Not oDic.Exists(i) Then oDic.Add i, F
Next
End With
Keys = oDic.Keys
Set oList = CreateObject("Scripting.FileSystemObject").OpenTextFile(List,,,-1)
Do
F = oList.ReadLine
For i = 0 To oDic.Count - 1
K = Keys(i)
If InStr(1, F, K, 1) Then
If InStr(F, " ") + InStr(F, vbTab) Then F = QM & F & QM
F = Replace(F, K, "%" & oDic(K) & "%", 1, -1, 1)
Exit For
End If
Next
All = All & vbCrLf & F
Loop Until oList.AtEndOfStream
oList.Close
With CreateObject("SAPI.SpFileStream")
.Format.Type = 1
.Open List, 3
.Write Mid(All, 3)
.Close
End With
CreateObject("WScript.Shell").Run "%ComSpec% /q/c clip<" & List, 0
oDic.RemoveAll
Set oDic = Nothing
Set oList = NothingOverquoting is evil! 👎
