LoginSignup
0
2

More than 3 years have passed since last update.

IDパスワード付き共有フォルダを自動で開くバッチ

Last updated at Posted at 2020-08-28

 実行するとID、パスワード付きの共有フォルダ(ネットワークフォルダ)を、エクスプローラーで開くバッチファイルです。
共有フォルダ名:\\drive\folder
ID:123
パスワード:pass
とします。

コマンドプロンプト/.bat
net use \\drive\folder /user:123 pass
start \\drive\folder

実行するとネットワークフォルダが開きます。

まずは、net useコマンドでネットワークフォルダに接続しています。

ネットワークフォルダに接続する
net use \\drive\folder /user:123 pass

 パス名 /user:の後にID,パスワードを半角スペースで区切って入力します。
https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/gg651155(v=ws.11)
net useコマンド マイクロソフト公式

ネットワークフォルダに接続したら、フォルダを開きます。

フォルダを開く
start \\drive\folder

startコマンドは、別プロセスでコマンドを実行するときに使うことが多いですが、フォルダを開くこともできます。
https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc770297(v=ws.11)
startコマンド マイクロソフト公式

 推奨はされないでしょうが、パス付きフォルダへの接続がダブルクリックだけになると、結構便利ですよ。

0
2
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
0
2