Article View: comp.lang.tcl
Article #75Re: something wrong with special char in "exec exploer.exe" command
From: Luis Alejandro Muzzachiodi
Date: Tue, 20 Oct 2026 21:26
Date: Tue, 20 Oct 2026 21:26
43 lines
3326 bytes
3326 bytes
El 20/10/2026 a las 3:52, meshparts escribió: > Am 20.10.2026 um 08:36 schrieb et99: >> Hi: >> >> In cmd.exe, = (like , and ;) acts as an argument delimiter, the same >> as a space, unless it is inside double quotes. So an unquoted t=4.out >> can be split into t and 4.out. Tcl's exec only quotes arguments >> containing whitespace, a double quote, or one of & | ^ < > ! ( ). The >> = sign isn't on that list, so t=4.out reaches the command line >> unquoted and gets mangled, and the quotes in your script are eaten by >> Tcl's parser. >> >> Skip explorer and use start with an empty title: >> >> exec cmd /c start "" [file nativename $path] & >> >> The "" matters: start treats its first argument, if quoted as the >> window title, so without it a quoted path (for example one with >> spaces) can be taken as the title instead of the file. Tcl passes the >> empty argument through as "", so start gets a real (empty) title and >> opens the path with the default program. >> >> -e >> > Thank you! This is very important thing to know. > So now I have the cmd and the twapi methods that seems to work fine. > Still, which one should I use? > Are there any other hidden traps that will crash either one? I guess the person who could best answer this is the author of twapi (Ashok P. Nadkarni). In any case, something to keep in mind: «The START command uses the same underlying Windows Shell API (ShellExecute) that explorer.exe uses when you double-click a file. It looks at the file's extension, checks the registry for the associated "FileType" (managed by the assoc command), and then looks up the command associated with that FileType (managed by the ftype command) to launch the correct program. This ensures your script respects the user's personal application choices.» (Credit : https://tutorialreference.com/batch-scripting/examples/faq/batch-script-how-to-open-a-file-with-its-default-program) Alejandro
Technical Details
Message-ID:
<11b8mad$3coa5$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11b5rl3$1fbh$1@tota-refugium.de> <11b724k$2ok9e$1@dont-email.me> <11b733k$28p7$1@tota-refugium.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Luis Alejandro Muzzachiodi <aleccp@yahoo.com> Newsgroups: comp.lang.tcl Subject: Re: something wrong with special char in "exec exploer.exe" command Date: Tue, 20 Oct 2026 18:26:37 -0300 Organization: A noiseless patient Spider Lines: 43 Message-ID: <11b8mad$3coa5$1@dont-email.me> References: <11b5rl3$1fbh$1@tota-refugium.de> <11b724k$2ok9e$1@dont-email.me> <11b733k$28p7$1@tota-refugium.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 20 Oct 2026 21:26:39 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3563845"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ZZpGCrz/aLqZ9uWwYuWyw"; posting-host="5d1c572ef626e597cba2b2025aa2715d" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:fATWjZh04bPvvT+W0np7q+JOPTU= sha256:5CFuSUnQnppuxdLF8msR4OoLc3b8iuAdtL6X2saY9q0= sha1:1mgi0g4yCIrcAo9TzecvD9m8aZQ= sha256:iijFp0cl+4btA0Fw7JOqAE85EYqNRxrQyP4CEeQ5iZQ= Content-Language: es-AR In-Reply-To: <11b733k$28p7$1@tota-refugium.de>