win7 当前目录创建快捷方式
2021-09-20 19:12
@ echo offtitle bat to dir or file testcolor 0acd /d %~dp0set onepath=%cd%echo -----------------------date:%date%-----------------------------echo %date% >> testfile.txtecho -----------------------time:%time%-----------------------------echo %time% >> testfile.txtecho -----------------create file and cat----------------------------for /l %%i in (1 1 10) do echo "this is test for test-%%i" >>testfile.txttype testfile.txtecho -----------------create dir testdir----------------------------------md testdir treeecho ------------------move testfile to testdir--------------------------move testfile.txt %onepath%\testdirecho ------------------rename testdir testdir1------------------------move testdir testdir1echo -------------------cd testdir1----------------------------------cd %onepath%\testdir1echo ------------------rename testfile.txt testfile1.txt------------------move testfile.txt testfile1.txtecho -------------------copy testfile1.txt testfile1.bak------------------copy testfile1.txt testfile.bakecho --------------------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 delaysetlocal EnableDelayedExpansionfor %%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