net share tmp=c:\temp /grant:admin,full /cache:auto
這是將c:\temp,設定分享,其分享名稱為tmp,權限指定給admin
所以本想利用for指令,如下,將某個資料夾下的所有子資料夾,一次設定成分享狀態,
for %1 in (c:\tmp\*.* )do ( net share %1=%1 /grant:admin,full /cache:auto )
但是一直試不出來,
請問,有何方式可以透過批次方式,一次設定好資料分享?
可列印頁面
net share tmp=c:\temp /grant:admin,full /cache:auto
這是將c:\temp,設定分享,其分享名稱為tmp,權限指定給admin
所以本想利用for指令,如下,將某個資料夾下的所有子資料夾,一次設定成分享狀態,
for %1 in (c:\tmp\*.* )do ( net share %1=%1 /grant:admin,full /cache:auto )
但是一直試不出來,
請問,有何方式可以透過批次方式,一次設定好資料分享?
那……直接把你所謂的「某個資料夾」分享出來不就好了?!
[QUOTE=bobhsieh;1117699]net share tmp=c:\temp /grant:admin,full /cache:auto
這是將c:\temp,設定分享,其分享名稱為tmp,權限指定給admin
所以本想利用for指令,如下,將某個資料夾下的所有子資料夾,一次設定成分享狀態,
for %1 in (c:\tmp\*.* )do ( net share %1=%1 /grant:admin,full /cache:auto )
但是一直試不出來,
請問,有何方式可以透過批次方式,一次設定好資料分享?[/QUOTE]
如果你的命令沒錯的話
for %%i in (c:\tmp\*.* )do ( net share %%i=%%i /grant:admin,full /cache:auto )
放到 .bat .cmd 裏應該就沒問題了
%1 是你輸入命令那行的第一個參數
test.bat 內容輸入
@echo off
cls
echo %1
test 12345<Enter>
12345