Using batch or powershell, create a script. In the current folder, search for every…
- User
Using batch or powershell, create a script. In the current folder, search for every subfolder for every file and create a shortcut fodler in the current folder. The name of the shortcut should bethe name of the subfolder - name of the file. The file and folder can contain japanese characters.
- Assistant
Here's a batch script that uses the
dircommand andmklinkto create shortcut folders in the current directory:@echo off setlocal enabledelayedexpansion for /d %%F in (*) do ( pushd "%%F" for %%G in (*) do ( set "folder=%%~nxF" set "file=%%~nxG" set "shortcut_name=!folder! - !file!" echo Creating shortcut folder: !shortcut_name! mklink /d "..\!shortcut_name!" "%%~fG" ) popd )And here's a PowerShell script that achieves the same:
$folderPath = (Get-Location).Path foreach ($folder in Get-ChildItem $folderPath -Directory) { Set-Location $folder.FullName foreach ($file in Get-ChildItem -File) { $folderName = $folder.Name $fileName = $file.Name $shortcutName = "$folderName - $fileName" Write-Host "Creating shortcut folder: $shortcutName" $shortcutPath = Join-Path $folderPath $shortcutName cmd /c mklink /d $shortcutPath $file.FullName } Set-Location $folderPath }Both scripts will create a shortcut folder in the current directory for each file found within subfolders. Japanese characters should be preserved in the folder and file names.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.