You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Cmder执行touch命令报错求助:‘touch’未被识别为有效命令

Fixing the 'touch' Command Not Recognized Error in Cmder

Hey there, let's get that pesky 'touch' command issue sorted out in Cmder. The error you're seeing ('touch' is not recognized as an internal or external command...) happens because touch is a Unix/Linux shell command, and the default Windows CMD environment Cmder might be using doesn't include it by default. Here are a few straightforward fixes:

Option 1: Switch to Git Bash in Cmder

If you installed Cmder with Git integration (the default full installation), you can just switch to a Git Bash session:

  • Click the small dropdown arrow at the top-right corner of your Cmder window
  • Select Git Bash from the list
  • Now try running touch your-file-name.txt – it should work perfectly, since Git Bash includes all standard Unix commands

Option 2: Set Git Bash as Your Default Cmder Terminal

If you want to use touch (and other Unix commands) every time you open Cmder, set Git Bash as your default startup task:

  1. Open Cmder's settings by pressing Win + Alt + P
  2. Navigate to Startup > Tasks
  3. Find the task named {bash::Git bash} (or similar) and select it
  4. Click the Set as default button at the bottom
  5. Restart Cmder, and you'll be in a Git Bash environment by default, ready to use touch

Option 3: Use Windows Native Alternatives (No Git Required)

If you don't have Git installed or just want a quick workaround, Windows has built-in commands that replicate touch's core functions:

  • To create a new empty file: type nul > your-file-name.txt
  • To update the timestamp of an existing file (without modifying its content): copy /b your-file-name.txt +,, (yes, that's three commas at the end)

Pick the option that fits your workflow best – the first two will give you a full Unix-like command experience, while the third is a handy quick fix for one-off uses.

内容的提问来源于stack exchange,提问作者Ahmed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 21:02:42