diff --git a/cmd/remove_test.go b/cmd/remove_test.go
index 6411fd5..7647614 100644
--- a/cmd/remove_test.go
+++ b/cmd/remove_test.go
@@ -9,7 +9,6 @@ import (
 	"runtime"
 	"strings"
 	"testing"
-	"time"
 
 	"github.com/google/go-cmp/cmp"
 	"github.com/nao1215/gup/internal/file"
@@ -316,10 +315,16 @@ func mockStdin(t *testing.T, dummyInput string) (funcDefer func(), err error) {
 	t.Helper()
 
 	oldOsStdin := os.Stdin
-	tmpFile, err := os.CreateTemp(t.TempDir(), time.Now().GoString())
-
-	if err != nil {
-		return nil, err
+	var tmpFile *os.File
+	var e error
+	if runtime.GOOS != "windows" {
+		tmpFile, e = os.CreateTemp(t.TempDir(), strings.ReplaceAll(t.Name(), "/", ""))
+	} else {
+		// See https://github.com/golang/go/issues/51442
+		tmpFile, err = os.CreateTemp(os.TempDir(), strings.ReplaceAll(t.Name(), "/", ""))
+	}
+	if e != nil {
+		return nil, e
 	}
 
 	content := []byte(dummyInput)
diff --git a/internal/print/print_test.go b/internal/print/print_test.go
index 4e03151..13bcf83 100644
--- a/internal/print/print_test.go
+++ b/internal/print/print_test.go
@@ -6,9 +6,9 @@ import (
 	"errors"
 	"io"
 	"os"
+	"runtime"
 	"strings"
 	"testing"
-	"time"
 
 	"github.com/google/go-cmp/cmp"
 )
@@ -294,10 +294,16 @@ func mockStdin(t *testing.T, dummyInput string) (funcDefer func(), err error) {
 	t.Helper()
 
 	oldOsStdin := os.Stdin
-	tmpFile, err := os.CreateTemp(t.TempDir(), time.Now().GoString())
-
-	if err != nil {
-		return nil, err
+	var tmpFile *os.File
+	var e error
+	if runtime.GOOS != "windows" {
+		tmpFile, e = os.CreateTemp(t.TempDir(), strings.ReplaceAll(t.Name(), "/", ""))
+	} else {
+		// See https://github.com/golang/go/issues/51442
+		tmpFile, e = os.CreateTemp(os.TempDir(), strings.ReplaceAll(t.Name(), "/", ""))
+	}
+	if e != nil {
+		return nil, e
 	}
 
 	content := []byte(dummyInput)