Thread from comp.lang.tcl (5 replies)

how to pass /E:ON argument to cmd.exe using exec (Windows)
Posted by Michael Soyka <mssr953@gmail.com> 2 days 5 hours ago

For a change of pace, this will not be a Tcl 9 question (I'm using 8.6.14).

Using tclsh, why does this succeed:
     exec -- cmd /C dir

but this fails:
     exec -- cmd /C /E:ON dir

with this message :
     "The filename, directory name, or volume label syntax is incorrect."

I'm guessing that "exec" is treating /E:ON as a file spec (the colon 
maybe?) and then changes it somehow.

A followup question is how can I see what string is being presented to 
to Windows?

Thanks for answering.

-mike

Click on article to view all threads in comp.lang.tcl
Re: how to pass /E:ON argument to cmd.exe using exec (Windows)
Posted by Ashok <apnmbx-public@yahoo.com> 2 days 4 hours ago

Nothing to do with Tcl 8.6 either :-)


 From the DOS prompt:

D:\src\tcl-csv\library>cmd /C /E:ON dir
The filename, directory name, or volume label syntax is incorrect.

The /C needs to be before dir

D:\src\tcl-csv\library>cmd /E:ON /C dir
  Volume in drive D is DATA
  Volume Serial Number is 8245-4F72

  Directory of D:\src\tcl-csv\library
.....




On 9/30/2024 9:05 PM, Michael Soyka wrote:
> For a change of pace, this will not be a Tcl 9 question (I'm using 8.6.14).
> 
> Using tclsh, why does this succeed:
>      exec -- cmd /C dir
> 
> but this fails:
>      exec -- cmd /C /E:ON dir
> 
> with this message :
>      "The filename, directory name, or volume label syntax is incorrect."
> 
> I'm guessing that "exec" is treating /E:ON as a file spec (the colon 
> maybe?) and then changes it somehow.
> 
> A followup question is how can I see what string is being presented to 
> to Windows?
> 
> Thanks for answering.
> 
> -mike

Click on article to view all threads in comp.lang.tcl
Re: how to pass /E:ON argument to cmd.exe using exec (Windows)
Posted by Michael Soyka <mssr953@gmail.com> 2 days 4 hours ago

Once again, read the fine manual before blaming Tcl!

Thanks Ashok!

And by the way, I love your book!

-mike

On 09/30/2024 12:34 PM, Ashok wrote:
> Nothing to do with Tcl 8.6 either :-)
> 
> 
>  From the DOS prompt:
> 
> D:\src\tcl-csv\library>cmd /C /E:ON dir
> The filename, directory name, or volume label syntax is incorrect.
> 
> The /C needs to be before dir
> 
> D:\src\tcl-csv\library>cmd /E:ON /C dir
>   Volume in drive D is DATA
>   Volume Serial Number is 8245-4F72
> 
>   Directory of D:\src\tcl-csv\library
> ....
> 
> 
> 
> 
> On 9/30/2024 9:05 PM, Michael Soyka wrote:
>> For a change of pace, this will not be a Tcl 9 question (I'm using 
>> 8.6.14).
>>
>> Using tclsh, why does this succeed:
>>      exec -- cmd /C dir
>>
>> but this fails:
>>      exec -- cmd /C /E:ON dir
>>
>> with this message :
>>      "The filename, directory name, or volume label syntax is incorrect."
>>
>> I'm guessing that "exec" is treating /E:ON as a file spec (the colon 
>> maybe?) and then changes it somehow.
>>
>> A followup question is how can I see what string is being presented to 
>> to Windows?
>>
>> Thanks for answering.
>>
>> -mike
> 

Click on article to view all threads in comp.lang.tcl
Re: how to pass /E:ON argument to cmd.exe using exec (Windows)
Posted by et99 <et99@rocketship1.me> 2 days 3 hours ago

On 9/30/2024 8:35 AM, Michael Soyka wrote:

> 
> A followup question is how can I see what string is being presented to to Windows?
> 

My goto tool is process explorer, much more detailed that windows task manager, just hover mouse over any process and it will tell you the command line that was ultimately received (or click and choose properties)

https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer

This is a no-install program, you can just run it.

Using twapi, and if you exec with & you will get the pid, you can then use:

twapi::get_process_commandline PID ?options?


-e

Click on article to view all threads in comp.lang.tcl
Re: how to pass /E:ON argument to cmd.exe using exec (Windows)
Posted by et99 <et99@rocketship1.me> 2 days 2 hours ago

On 9/30/2024 11:15 AM, et99 wrote:
> On 9/30/2024 8:35 AM, Michael Soyka wrote:
> 
>>
>> A followup question is how can I see what string is being presented to to Windows?
>>
> 
> My goto tool is process explorer, much more detailed that windows task manager, just hover mouse over any process and it will tell you the command line that was ultimately received (or click and choose properties)
> 
> https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer
> 
> This is a no-install program, you can just run it.
> 
> Using twapi, and if you exec with & you will get the pid, you can then use:
> 
> twapi::get_process_commandline PID ?options?
> 
> 
> -e
> 
Hmmm, it just occurred to me that if the process dies immediately, you might not have a chance with process explorer, and don't know if the get_process_commandline will be quick enough either.

Click on article to view all threads in comp.lang.tcl
Re: how to pass /E:ON argument to cmd.exe using exec (Windows)
Posted by Michael Soyka <mssr953@gmail.com> 2 days ago

On 09/30/2024 2:33 PM, et99 wrote:
> On 9/30/2024 11:15 AM, et99 wrote:
>> On 9/30/2024 8:35 AM, Michael Soyka wrote:
>>
>>>
>>> A followup question is how can I see what string is being presented 
>>> to to Windows?
>>>
>>
>> My goto tool is process explorer, much more detailed that windows task 
>> manager, just hover mouse over any process and it will tell you the 
>> command line that was ultimately received (or click and choose 
>> properties)
>>
>> https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer
>>
>> This is a no-install program, you can just run it.
>>
>> Using twapi, and if you exec with & you will get the pid, you can then 
>> use:
>>
>> twapi::get_process_commandline PID ?options?
>>
>>
>> -e
>>
> Hmmm, it just occurred to me that if the process dies immediately, you 
> might not have a chance with process explorer, and don't know if the 
> get_process_commandline will be quick enough either.
> 
Yes, in my case, the process would die almost immediately but, if /K is 
used instead of /C, the process does hang around and your suggestions 
would work.  Thanks for the advice.
-mike

Click on article to view all threads in comp.lang.tcl