|
Post by alvaroafernandez on Jan 8, 2023 7:50:34 GMT 1
To start my application, I call a batch file p.bat
p.bat echoes %%USERNAME%% to a file username.txt, and then calls the application.
echo %%USERNAME%%>C:\EMAIL\USERNAME.TXT
When the application starts, it reads the file username.txt for the windows username, and then does an internal lookup for the internal password that this tag it read in corresponds to.
When I look in the program for the value of the file, the compare fails. I then check the value of the user name in the debugger I am using, and note that the value of environment variable %USERNAME% has been truncated by what appears to be a varying number of characters.
But, when I simply type the value of the %USERNAME% directly into the file USERNAME.TXT without using an echo statement to generate it, the value of USERNAME read in is correct.
My conjecture: echo in Vdos appends control characters which are confusing my application. This is also suggested when I run echo %%USERNAME%% from the command line, and the resulting output appears to have a carriage return after it.
Does echo in VDOS differ in this way from the way it is in e.g. Windows?
|
|
|
Post by Jos on Jan 8, 2023 9:03:32 GMT 1
vDos ECHO is supposed to work the same as in DOS or Windows. That is to append a <CR><LF> combination.
To the mangled output: Could it be you’re using vDos 2020.03.01? Its output redirection was somewhat ‘sticky’.
Jos
|
|
|
Post by alvaroafernandez on Jan 8, 2023 19:06:57 GMT 1
Thanks for getting back to me. I am using vdos 2022.05.01.
It's an odd situation. This approach usually works fine in plain Windows, but it's suddenly broken when moving to VDOS, hence my suspicions. But at least at first glance, echo generates the same thing in both, with what is presumably a single crlf at the end.
In Vdos:
|
|
|
Post by Jos on Jan 8, 2023 20:02:42 GMT 1
You could add a PAUSE command after the ECHO in the batch file. Open USERNAME.TXT in a text editor while the batch file is paused, and check its content. Keep the file open, continu the batch file, and check the content again.
Jos
|
|