Here-Document on new Install

I have purchased a new system with Windows 10 Pro, and have installed;
Code:
TCC  24.02.49 x64   Windows 10 [Version 10.0.17763.503]

On my previous Windows 7 system, the following example worked as it should;
Code:
@setlocal
@echo off
type <<- endtext > results.txt
This is parameter %1
endtext
type results.txt
endlocal

However, it does not work on my Windows 10 Pro system, due to how I installed Windows 10 Pro.

On my Windows 7 system, my USERPROFILE was in C:\Users\jlc

On my Windows 10 system, my USERPROFILE is in C:\Users\Joe Caverly

When I run the above example, it returns with an error;
Code:
e:\utils>test.btm
TCC: (Sys) E:\Utils\test.btm [5]  The system cannot find the file specified.
"C:\Users\Joe"

Yes, in hind sight, I should have setup a user profile with no spaces, but is there a way I can eliminate this error?

Joe
 
May 20, 2008
11,401
99
Syracuse, NY, USA
What's the connection between the error and the code? It's noy obvious. Line 5 is "endtext"; I wouldn't expect a file_not_found error there.
 
Nor would I.

It would seem that some sort of piping is taking place, and while it worked previously with my no-space userprofile, it no longer works with my one-space userprofile.

I think that maybe it is somehow trying to read/write to;
Code:
c:\users\joe caverly\appdata\local\jpsoft

...and cannot do so, due to the space in the path.

Joe
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
Trying to think of a more elegant way. Do you have admin access to this machine? Perhaps you could
Code:
mklink /d c:\users\JLC "c:\users\joe caverly"
and then redefine the TEMP and TMP variables accordingly.

But really, you shouldn't have to do any of this. Piping should not break just because your temp directory has a funky name. I think you have uncovered a bona fide bug in need of correction.
 
But really, you shouldn't have to do any of this. Piping should not break just because your temp directory has a funky name. I think you have uncovered a bona fide bug in need of correction.

Not a bug, but an "Undocumented feature".

Yes, I am running as Administrator. I have added the following to my TCSTART.BTM;
Code:
  if not exist c:\users\jlc mklink /d c:\users\JLC "c:\users\joe caverly"
  set temp=C:\Users\jlc\AppData\Local\Temp
  set tmp=C:\Users\jlc\AppData\Local\Temp

...and my test code works!

Joe
 
Aug 23, 2010
637
9
If a program intended to work with files fails to interpret a filesystem path, it's a bug.
But, frankly speaking, who make usernames with spaces?
If you want a "mail name", there's a special field in user's attributes for that.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
I don't have access to the source, but I think I can guess how it works. I'll bet the chunk of text between <<- and ENDTEXT is written to a temp file, and then the original command line is massaged, changing the << ENDTEXT to <filename. And Rex is writing the filename verbatim, without quote marks, because who the hell creates a temp directory with spaces? If I'm right, it should be a one-line fix.
 
May 20, 2008
11,401
99
Syracuse, NY, USA
Back to the beginning. Is this even a valid use of a here-document?
Code:
type <<- endtext > results.txt
This is parameter %1
endtext

From the help:
The current batch file is read up to the next occurrence of word, and the resulting text becomes standard input to program.

TYPE isn't expecting any standard in (except perhaps a few keystrokes to dismiss pauses). I think a proper use of a here document looks more like this:
Code:
v:\> type lucky.btm
nslookup <<- endinput > lookupresults.txt
lucky.syr.edu
exit
endinput

I think that TYPE working with a here-document is a fluke.

In any event, there's still a problem. Even the correct (?) usage (lucky.btm, above) suffers when TEMP/TMP contains a spece.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
TYPE isn't expecting any standard in (except perhaps a few keystrokes to dismiss pauses).
...
I think that TYPE working with a here-document is a fluke.

It's not documented, but TYPE as a filter is an old feature, predating here-documents. In fact I think it goes back to 4DOS.
Code:
ipconfig | type /l
 
May 20, 2008
11,401
99
Syracuse, NY, USA
It's not documented, but TYPE as a filter is an old feature, predating here-documents. In fact I think it goes back to 4DOS.
Code:
ipconfig | type /l
I didn't know that; it's not mentioned in the 4DOS printed manual. "/P" doesn't work in that scenario ... too bad, it could be used like MORE.
 
Not that it matters, but I note that during the install of some other software packages, they seem to be using the Short-File name when writing to the %TEMP folder, that is;
Code:
e:\utils>echo %@sfn[C:\Users\Joe Caverly\AppData\Local\Temp]
C:\Users\JOECAV~1\AppData\Local\Temp

After doing much googling, it would appear that it is not uncommon for the %USERPROFILE to contain spaces, but a %USERPROFILE with no spaces makes things simpler.

Joe
 
May 20, 2008
11,401
99
Syracuse, NY, USA
In ControlPanel\UserAccounts is "Change your account name". I don't know how far the change actually goes; maybe it'll rename the profile directory.
 
May 20, 2008
11,401
99
Syracuse, NY, USA
Similar is COMPMGMT.MSC ..."Local Users and Groups" ... Users ... right click the username and choose "rename".
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
Not that it matters, but I note that during the install of some other software packages, they seem to be using the Short-File name when writing to the %TEMP folder, that is;
Code:
e:\utils>echo %@sfn[C:\Users\Joe Caverly\AppData\Local\Temp]
C:\Users\JOECAV~1\AppData\Local\Temp

So your fix might be as simple as
Code:
set temp=%@sfn[%temp]
set tmp=%@sfn[%tmp]

Or the equivalent via the environment control panel.
 
May 20, 2008
11,401
99
Syracuse, NY, USA
What's the default 8dot3 setting on Win10? I changed mine from 2 (volume specific) to 1 (disabled on all volumes) but I don't know what the volume specific settings were before that. Find out with, for example,
Code:
fsutil 8dot3name query [drive:]
 
On my brand new install of Windows 10 Pro;

Code:
e:\utils>fsutil 8dot3name query c:
The volume state is: 0 (8dot3 name creation is enabled).
The registry state is: 2 (Per volume setting - the default).

Based on the above settings, 8dot3 name creation is enabled on c:

e:\utils>fsutil 8dot3name query e:
The volume state is: 1 (8dot3 name creation is disabled).
The registry state is: 2 (Per volume setting - the default).

Based on the above settings, 8dot3 name creation is disabled on e:

2327


Joe
 
Similar threads
Thread starter Title Forum Replies Date
nikbackm Switch Case and here-document redirection Support 2
A Here document Support 3
T @replace -- what is wrong here Support 2
J Vers. 18 Here doc redirection broken? Support 4
B Newbie here, I have a question. Support 4
M What's going on here????? Support 6
M Simply put, Help! (I can't figure out what's going on here.) Support 6
M What am I doing wrong here? Support 2
Mordachai TCMD Prompt Here?!@ Support 14
K_Meinhard Fixed ? TCMD 14.02 doesn't start here Support 4
vefatica What's wrong here? Support 2
vefatica What's happening here? Support 3
Charles Dye Strange output, here-doc redirection, TYPE, //UnicodeOutput=Yes Support 6
CWBillow TCMD prompt here only opens to root Support 6
M open Take Command here right-click? Support 2
H "Here-String" redirection not working Support 6
M TCC Prompt Here Colors Support 0
E Single instance/TCMD Here problem Support 7
R Start Prompt Here? Support 9
vefatica What's happening here? Support 9
fishman@panix.com 27.00.17 x64 will not install for me!! Support 4
S 32-bit Take Command v22 install for thumb drive Support 1
Roedy install fail Support 9
A Reinstalling TCC-RT 21.01.57 triggers a new install instead of update/reinstall Support 3
R Portable install with v21 - why did it not work? Support 3
G How to? Unable to install TCMD 21 under Win2012R2 Support 5
samintz Build 38 Install issue Support 5
N Cannot install Support 2
fishman@panix.com Version 21.23 fails to install Support 4
Seven Update / install issue with 20.0.20.10.32 take command Support 7
keithg1964 TCC RT Install Files Support 1
fishman@panix.com Once again the Can't Install bug bites... Support 2
Roedy missing English.dll, failed install Support 2
T Beta - duplicate install Support 7
J How to? 20beta: How to install x86 on x64 Support 2
fishman@panix.com 19.10.51 will not install for me Support 1
A Latest TCC/LE install broken Support 1
M How to? Take Command\TCC install problem... Support 2
H New Install; Everything setup issues Support 9
fishman@panix.com 19.02.37 Does Not Install For Me Support 2
D V19 fails to install on Win7-64bit, installer says: Support 2
Alpengreis [TC 19.0 Beta 22/23] Install/Update-"Problems" Support 4
bwawsc2 Can't install updates to TCMD x64 Support 5
fishman@panix.com 18.00.31 would not install for me Support 5
M How to? Run TCC from Windows Install DVD... Support 2
T Everything install forced (sometimes) Support 2
vefatica Build 28 install Support 8
S How to? Remote Install Support 1
I Take Command 18 x64 Install Hang Support 2
vefatica Build 14 install Support 3

Similar threads