summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/exec.test16
-rwxr-xr-xwin/tclWinFile.c1
-rw-r--r--win/tclWinPipe.c7
3 files changed, 20 insertions, 4 deletions
diff --git a/tests/exec.test b/tests/exec.test
index 16a8320..38927d3 100644
--- a/tests/exec.test
+++ b/tests/exec.test
@@ -682,6 +682,22 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup {
} -cleanup {
removeFile $tmpfile
} -result 14
+
+# Tests to ensure batch files and .CMD (Bug 9ece99d58b)
+# can be executed on Windows
+test exec-20.0 {exec .bat file} -constraints {win} -body {
+ set log [makeFile {} exec20.log]
+ exec [makeFile "echo %1> $log" exec20.bat] "Testing exec-20.0"
+ viewFile $log
+} -result "\"Testing exec-20.0\""
+test exec-20.1 {exec .CMD file} -constraints {win} -body {
+ set log [makeFile {} exec201.log]
+ exec [makeFile "echo %1> $log" exec201.CMD] "Testing exec-20.1"
+ viewFile $log
+} -result "\"Testing exec-20.1\""
+
+
+
# ----------------------------------------------------------------------
# cleanup
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 3e8a171..dbfdfd0 100755
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1795,7 +1795,6 @@ NativeIsExec(
if ((_tcsicmp(path+len-3, TEXT("exe")) == 0)
|| (_tcsicmp(path+len-3, TEXT("com")) == 0)
|| (_tcsicmp(path+len-3, TEXT("cmd")) == 0)
- || (_tcsicmp(path+len-3, TEXT("ps1")) == 0)
|| (_tcsicmp(path+len-3, TEXT("bat")) == 0)) {
return 1;
}
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index aff8836..382addd 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -897,7 +897,7 @@ TclpGetPid(
*
* The complete Windows search path is searched to find the specified
* executable. If an executable by the given name is not found,
- * automatically tries appending ".com", ".exe", and ".bat" to the
+ * automatically tries appending standard extensions to the
* executable name.
*
* Results:
@@ -1292,7 +1292,7 @@ ApplicationType(
Tcl_DString nameBuf, ds;
const TCHAR *nativeName;
TCHAR nativeFullPath[MAX_PATH];
- static const char extensions[][5] = {"", ".com", ".exe", ".bat"};
+ static const char extensions[][5] = {"", ".com", ".exe", ".bat", ".cmd"};
/*
* Look for the program as an external program. First try the name as it
@@ -1337,7 +1337,8 @@ ApplicationType(
Tcl_DStringFree(&ds);
ext = strrchr(fullName, '.');
- if ((ext != NULL) && (strcasecmp(ext, ".bat") == 0)) {
+ if ((ext != NULL) &&
+ (strcasecmp(ext, ".cmd") == 0 || strcasecmp(ext, ".bat") == 0)) {
applType = APPL_DOS;
break;
}