有時候臨時要傳一個檔案與別人分享,用msn傳嫌太慢,需要一個臨時上傳的空間。網路上有許多免費上傳檔案的空間,若能與檔案總管整合在一起使用,那就很方便。底下的 bat 即是此應用的實現,需搭配 curl 使用 。
Visual Basic:
-
@echo off
-
del tmp.txt 2> nul
-
setlocal ENABLEDELAYEDEXPANSION
-
-
:LOOP
-
if ()==(%1) GOTO END
-
curl -o 1.htm -F filetoupload=@%1 -F submitted="Upload File" http://mooload.com/new/upload/upload.php
-
for /f "tokens=1 delims=>" %%i in ('findstr file.php 1.htm ^| findstr href') do @(
-
set url1=%%i_
-
rem echo ORig url1: !url1!
-
rem echo !url1:~5,-1!
-
curl -o 2.htm !url1:~5,-1!
-
for /f "tokens=2 delims==>" %%j in ('findstr Click 2.htm') do @(
-
set url2=%%j
-
rem echo ORig url2: !url2!
-
rem echo !url2:~1,-1!
-
echo !url2:~1,-1!>> tmp.txt
-
)
-
)
-
-
shift
-
goto LOOP
-
-
:END
-
-
IF EXIST tmp.txt start tmp.txt
-
-
del 1.htm 2.htm 2> nul
-
-
setlocal DISABLEEXTENSIONS
存檔「上傳檔案.bat」,放到非系統槽的任一地方,拉一個捷徑到SendTo資料夾,用捷徑的方式才能改變圖示。在欲上傳的檔案(可多選),按右鍵,選擇「傳送到-> 上傳檔案」即可。上傳完畢會開啟記事本,內容是下載網址。此上傳網路空間不限制檔案格式,就算是圖檔、執行檔也可以上傳 

Tags: Script