In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Note: bat scripts use ANSI encoding
First kind
@ 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
two。 The second kind
@ 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--
:: set the full path to the program or file (required)
Set sourcefile=%onepath%\ testfile.txt
:: set shortcut name (required)
Set LnkName=testfile
:: set the working path of the program, which is usually the main directory of the program. If this item is left blank, the script will analyze the path by itself.
:: set WorkDir=
:: set the description of the shortcut display (optional)
Set Desc= test
(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. Example files and folders both create shortcuts
@ 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 an 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
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.