第1个回答 2023-03-26
不清楚你的实际文件/情况,仅以问题中的说明及猜测为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI/GB2312<# :
cls&echo off&cd /d "%~dp0"&set "current=%cd%"
rem 读取剪贴板内容作为名字,在指定目录里新建一个文件夹并且打开该文件夹
set #=Any questions&set _=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%_% %z%
set "specifiedpath=C:\xxx\指定目录"
powershell -NoProfile -ExecutionPolicy bypass "Get-Content -literal '%~f0'|Out-String|Invoke-Expression"
echo;%#% +%$%%$%/%_% %z%
pause
exit
#>
$specifiedpath=($env:specifiedpath).trimend('\')
Add-Type -AssemblyName System.Windows.Forms;$name='';
if([Windows.Forms.Clipboard]::ContainsText()){
$name=[Windows.Forms.Clipboard]::GetText() -split '[\r\n]';
$newfolder=$specifiedpath+'\'+$name[0].trim();
if(-not (test-path -literal $newfolder)){
try{
[void][IO.Directory]::CreateDirectory($newfolder);
}catch{write-host 'Illegal characters';}
}
Start-Process explorer.exe $newfolder;
}else{wrrite-host 'No text';}本回答被提问者采纳