注:bat腳本使用ANSI編碼
成都創(chuàng)新互聯(lián)公司提供高防主機、云服務(wù)器、香港服務(wù)器、綿陽服務(wù)器托管等第一種
@ echo off cd /d %~dp0 set onepath=%cd% echo -----------------create file and cat---------------------------- for /l %%i in (1 1 10) do echo "this is test for test-%%i" >>testfile.txt type testfile.txt tree echo -----------------create file link---------------------------------- set sourcefile=%onepath%\testfile.txt echo [InternetShortcut] >>testfile.url echo URL="%sourcefile%" >>testfile.url echo IconIndex=0 >> testfile.url echo IconFile="%onepath%\testfile.txt%" >>testfile.url echo %errorlevel% pause |
2.第二種
@ echo off color 0a set onepath=%cd% echo -----------------create file and cat---------------------------- for /l %%i in (1 1 10) do echo "this is test for test-%%i" >>testfile.txt type testfile.txt tree echo -----------------create file link---------------------------------- ::設(shè)置程序或文件的完整路徑(必選) set sourcefile=%onepath%\testfile.txt ::設(shè)置快捷方式名稱(必選) set LnkName=testfile ::設(shè)置程序的工作路徑,一般為程序主目錄,此項若留空,腳本將自行分析路徑 ::set WorkDir= ::設(shè)置快捷方式顯示的說明(可選) set Desc=測試 (echo Set WshShell=CreateObject("WScript.Shell"^) echo strDesKtop=WshShell.SpecialFolders("%onepath%"^) echo Set oShellLink=WshShell.CreateShortcut("%onepath%" ^&"\%LnkName%.lnk"^) echo oShellLink.TargetPath="%sourcefile%" echo oShellLink.WorkingDirectory="%onepath%" echo oShellLink.WindowStyle=1 echo oShellLink.Description="%Desc%" echo oShellLink.Save)>makelnk.vbs makelnk.vbs del /f /q makelnk.vbs ::exit if %errorlevel%==0 ( echo create file link success! ) echo ---------------------------------------create dir link------------------------------- tree %onepath% pause |
3. 舉例文件與文件夾均創(chuàng)建快捷方式
@ echo off title bat to dir or file test color 0a cd /d %~dp0 set onepath=%cd% echo -----------------------date:%date%----------------------------- echo %date% >> testfile.txt echo -----------------------time:%time%----------------------------- echo %time% >> testfile.txt echo -----------------create file and cat---------------------------- for /l %%i in (1 1 10) do echo "this is test for test-%%i" >>testfile.txt type testfile.txt echo -----------------create dir testdir---------------------------------- md testdir tree echo ------------------move testfile to testdir-------------------------- move testfile.txt %onepath%\testdir echo ------------------rename testdir testdir1------------------------ move testdir testdir1 echo -------------------cd testdir1---------------------------------- cd %onepath%\testdir1 echo ------------------rename testfile.txt testfile1.txt------------------ move testfile.txt testfile1.txt echo -------------------copy testfile1.txt testfile1.bak------------------ copy testfile1.txt testfile.bak echo --------------------move testdir1/testfile1.txt to %onepath%-------- move testfile1.txt %onepath% echo ------------------cd %onepath%----------------------------- cd %onepath% echo ------------------list %onepath%--------------------------- tree %onepath% echo -------------------create link-------------------------------------- ::set var delay setlocal EnableDelayedExpansion for %%a in (testfile1.txt testdir1) do ( echo "star create link" (echo Set WshShell=CreateObject("WScript.Shell"^) echo strDesKtop=WshShell.SpecialFolders("%onepath%"^) echo Set oShellLink=WshShell.CreateShortcut("%onepath%" ^&"\%%a-test.lnk"^) echo oShellLink.TargetPath="%onepath%\%%a" echo oShellLink.WorkingDirectory="%onepath%" echo oShellLink.WindowStyle=1 echo oShellLink.Save)>makelnk.vbs makelnk.vbs if %errorlevel%==0 ( echo "create %%a link success!" ) ::type makelnk.vbs del /f /q makelnk.vbs ) if %errorlevel%==0 ( echo "create all link success!" ) echo -------------list %onepath% structure--------- tree %onepath% echo -------------dir %onepath%--------- dir %onepath% pause |
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
文章名稱:win7當(dāng)前目錄創(chuàng)建快捷方式-創(chuàng)新互聯(lián)
文章出自:http://jinyejixie.com/article48/dpeshp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、域名注冊、響應(yīng)式網(wǎng)站、網(wǎng)站維護、營銷型網(wǎng)站建設(shè)、電子商務(wù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)