LoginSignup
4
4

More than 5 years have passed since last update.

【備忘録】ネットワークドライブとUNCの変換と、それに伴うハック

Last updated at Posted at 2015-10-09

そもそもさ、 UNC でふつーのファイル参照と同じ事させてくれないのがイケてないよねとゆー話をグッと飲み込みつつ。

バッチにしておく

これ確かどこかのブログからひっぱってきたんですよね。
netuse でドライブの一覧を出して、そこからUNCをひっぱってきて引数のパスとくっつける。

getunc.bat
@echo off
if "%~1" == "" (
 echo no args
 exit /b 1
)
SETLOCAL
SET "D_=%~d1"
SET "P_=%~pnx1"
for /F "tokens=1,2,3" %%I in ('net use ^| findstr /I %D_%') do if "%%I" == "OK" (set "UNC=%%K" ) else ( set "UNC=%%J" )
if "%UNC%" == "" (
    echo %~dpnx1
) else (
    echo %UNC%%~pnx1
)

sendto フォルダにでも入れておく

explorerで開いたりクリップボードに貼りつけるようなバッチをつくっておいて sendto フォルダに入れましょう。
win7 以降ならアドレスバーとかに shell:sendto って入れれば行けます。

バグ

* パスの中に一部の全角文字と、カンマがはいっているとうまくうごかないです。
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4