@REGQUERY with hostname fails

May 20, 2008
Syracuse, NY, USA
This was working back in September. @REGQUERY fails whenever a hostname, local or remote, is given.
v:\> echo %@regquery[HKU\.DEFAULT\Environment\TEMP]

v:\> echo %_winname

v:\> echo %@regquery[\\zz\HKU\.DEFAULT\Environment\TEMP]

v:\> echo %@regquery[\\lucky\HKU\.DEFAULT\Environment\TEMP]

With a '.' as hostname, it seems to work but gives a result which is incorrect.
v:\> echo %@regquery[\\.\hklm\system\currentcontrolset\services\w32time\w32tmparams\ratedefault]
53 (incorrect)

v:\> echo %@regquery[hklm\system\currentcontrolset\services\w32time\w32tmparams\ratedefault]
156001 (correct)

And the help for many of the @REG functions contains a sentence apparently copied from @REGBREAD but not personalized for the function in question. For example, %REGQUERY's help says
If the key name begins with \\machinename, @REGBREAD opens ...
May 20, 2008
Syracuse, NY, USA
P.S., I gather the "53" mentioned in the previous post is Windows error 53, "The network path was not found".
May 20, 2008
Syracuse, NY, USA
Fixed in build 68.
The failure when it should work is fixed but @REGQUERY still evaluates to "53" (as if it had worked) when the network path couldn't be found. "53" is a Windows error code.
v:\> echo %@regquery[\\no-exist\HKU\.DEFAULT\Environment\TEMP]
May 20, 2008
Syracuse, NY, USA
I don't understand your point -- what did you want it to evaluate to when you pass it a bad argument?
I'd expect
TCC: (Sys) The network path was not found.
or some indication that the evaluation of the variable function failed.
May 20, 2008
Syracuse, NY, USA
P.S., The "53" is the return value of RegConnectRegistry(); it's not from GetLastError().

And when viewing a thread, the user names (under the avatar) are no longer centered ... don't know why but it sticks out like a sore thumb.
May 29, 2008
Groton, CT
You could use @REGEXIST to determine whether a -1 return from @REGQUERY is an indication of an error or the actual value.
May 20, 2008
Syracuse, NY, USA
You could use @REGEXIST to determine whether a -1 return from @REGQUERY is an indication of an error or the actual value.
I don't want to, but even that seems to fail, not returning 0 or 1 as documented.
v:\> echo %@regexist[\\no-exist\HKU\.DEFAULT\Environment\TEMP]
That's the Windows error code for "The network path was not found".


Staff member
May 14, 2008

Well -- no. If a variable function fails, it doesn't return *anything* (just an error message). Some variable functions expect the occasional missing argument or result, and return -1 to indicate they didn't find something.

The question is whether a non-existent machine name is a fatal error (abort the command line) or an occasionally expected error (return some error code).
Similar threads
Thread starter Title Forum Replies Date
S %@REGQUERY function Support 1
J How to use RegQuery for value with \name Support 2
old coot Debugging .btm with >3 arguments fails on step. Support 3
bwawsc2 Check for updates fails to complete Support 9
samintz COPY fails to copy from \\wsl$ Support 20
M Goto fails when a text endtext block precedes the code Support 5
vefatica SETP usually fails with a 32 bit process Support 4
S INPUT fails if the entered text contains pair of square brackets Support 6
B Request Manual Key fails Support 3
L TCC V22 installer fails signature validation Support 0
A Fixed v25 regression: Parameter expansion fails in piped commands Support 2
vefatica START /PGM "name with spaces.URL" fails Support 2
I zip /M fails to delete file after adding to zip file Support 2
D skip= in FOR /F fails Support 9
Joe Caverly Using a Directory Alias with @iniwrite fails Support 14
A WAD Output redirection to IF block fails with "unbalanced brackets" Support 7
E My echo full file name to the clipboard fails now. Support 2
A Fixed (CMD compat) START /D fails to recognize the switch option. Support 3
B MKLINK requires admin - fails silently. Support 1
D Fixed Take Command 21.0.29 fails – MSVCP140.dll missed Support 6
F Powershell call fails with "Scripting Integrator 2016 (PowerShell)" license error Support 9
fishman@panix.com Version 21.23 fails to install Support 4
D unzip fails to find valid license Support 3
StarliteLemming Fileread fails on Unicode file Support 10
D Upgrade from 19 to 19.10 fails Support 2
C Upgrade to v19.10.42 fails Support 5
D V19 fails to install on Win7-64bit, installer says: Support 2
bervin Webform fails on HTTPS Support 1
thedave Windows 10: Pinned taskbar fails Support 20
P MS VS2013 vsdevcmd.bat fails to run with tcmd 17 x64 Support 10
tmaynard Bug Typesafe Activator fails under Take Command shell Support 2
R Fixed Internal ZIP command fails to process multiple files Support 3
P Copying descript.ion file fails Support 8
S WAD FTP copy fails in 16.00.25 Support 24
S WAD KEYSTACK fails in TCC-64 Support 2
vefatica Files disappear in Explorer when DEL fails Support 6
T tcc /c "[...]" fails when run from third party terminal Support 11
C Latest TCMDx64 fails on XP Pro x64 Support 1
dcantor WAD dir "ftp:// ..." fails in TCC 15 Support 7
M WAD Copy command fails rather weirdly... Support 2
S WAD COPY from FTP site fails in 14.03.51 Support 9
M Updating environment variable from C++ fails erratically in version 14... Support 57
dcantor Take Command 14 release fails Support 6
S WAD "Mark Forums Read" fails Support 4
dcantor Fixed Take Command 14.0.20 fails Support 19
D Upgrade from b12 fails Support 5
scottb Toolbar filter by directory attribute /A:D fails Support 1
Stefano Piccardi IDE.exe start toobar button fails when % in script path Support 0
H Install fails and removes tcmd Support 4
vefatica 12.10 registration fails Support 3

Similar threads