我试图将以下命令结果/输出输出到.txt文件中,该文件位于.cmd脚本所在的相同位置。
@ECHO OFF
@rem ----[ This code block detects if the script is being running with admin PRIVILEGES If it isn't it pauses and then quits]-------
echo OFF
NET SESSION >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
ECHO Administrator PRIVILEGES Detected!
) ELSE (
echo ######## ######## ######## ####### ########
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ###### ######## ######## ## ## ########
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ######## ## ## ## ## ####### ## ##
echo.
echo.
echo ####### ERROR: ADMINISTRATOR PRIVILEGES REQUIRED #########
echo This script must be run as administrator to work properly!
echo If you're seeing this after clicking on the icon, then right click on the script and select "Run As Administrator".
echo ##########################################################
echo.
PAUSE
EXIT /B 1
)
@echo ON
@echo OFF
call :out >output.txt
exit /b
:out
rem -- This ends tasktree on LEAP Desktop.exe --
Taskkill /IM "LEAPWDSService.exe" /F
Taskkill /IM "LEAP Office Documents.exe" /F
Taskkill /IM "LEAP Office Documents client.exe" /F
Taskkill /IM "LEAP Office Accounting.exe" /F
Taskkill /IM "LEAP Office Accounting client.exe" /F
rem -- This uninstalls LEAP V10 32-Bit from the PC --
@Echo Uninstalling LEAP Office Documents Client for 32-Bit Operating Systems, This may take a few minutes...
@Echo Off
Title LEAP Office Documents Client for 32-Bit Operating Systems
Echo LEAP Office Documents Client for 32-Bit Operating Systems
WMIC Product Where "Name='LEAP Office Documents Client for 32-Bit Operating Systems'" Call Uninstall /NoInteractive
@Echo Uninstalling LEAP Office Accounting Client for 32-Bit Operating Systems, This may take a few minutes...
@Echo Off
Title LEAP Office Accounting Client for 32-Bit Operating Systems
Echo LEAP Office Accounting Client for 32-Bit Operating Systems
WMIC Product Where "Name='LEAP Office Accounting Client for 32-Bit Operating Systems'" Call Uninstall /NoInteractive
@Echo Uninstalling LEAP Office Accounting Single User for 32-Bit Operating Systems, This may take a few minutes...
@Echo Off
Title LEAP Office Accounting Single User for 32-Bit Operating Systems
Echo LEAP Office Accounting Single User for 32-Bit Operating Systems
WMIC Product Where "Name='LEAP Office Accounting Single User for 32-Bit Operating Systems'" Call Uninstall /NoInteractive
@Echo Uninstalling LEAP Office Documents Single User for 32-Bit OS, This may take a few minutes...
@Echo Off
Title LEAP Office Documents Single User for 32-Bit OS
Echo LEAP Office Documents Single User for 32-Bit OS
WMIC Product Where "Name='LEAP Office Documents Single User for 32-Bit OS'" Call Uninstall /NoInteractive
rem -- This uninstalls LEAP V10 64-Bit from the PC --
@Echo Uninstalling LEAP Office Documents Client for 64-Bit Operating Systems, This may take a few minutes...
@Echo Off
Title LEAP Office Documents Client for 64-Bit Operating Systems
Echo LEAP Office Documents Client for 64-Bit Operating Systems
WMIC Product Where "Name='LEAP Office Documents Client for 64-Bit Operating Systems'" Call Uninstall /NoInteractive
@Echo Uninstalling LEAP Office Accounting Client for 64-Bit Operating Systems, Please follow the prompts...
@Echo Off
Set "GUID="
For /F "Tokens=2Delims==}" %%A In ('WMIC Product Where "Name='LEAP Office Accounting Client for 64-Bit Operating Systems'" Get IdentifyingNumber /Value 2^>Nul') Do Set "GUID=%%A}"
"C:\Program Files (x86)\InstallShield Installation Information\%GUID%\setup.exe" /m:uninstall
@Echo Uninstalling LEAP Office Accounting Single User for 64-Bit Operating Systems, Please follow the prompts...
@Echo Off
Set "GUID="
For /F "Tokens=2Delims==}" %%A In ('WMIC Product Where "Name='LEAP Office Accounting Single User for 64-Bit Operating Systems'" Get IdentifyingNumber /Value 2^>Nul') Do Set "GUID=%%A}"
"C:\Program Files (x86)\InstallShield Installation Information\%GUID%\setup.exe" /m:uninstall
@Echo Uninstalling LEAP Office Documents Single User for 64-Bit OS, This may take a few minutes...
@Echo Off
Title LEAP Office Documents Single User for 64-Bit OS
Echo LEAP Office Documents Single User for 64-Bit OS
WMIC Product Where "Name='LEAP Office Documents Single User for 64-Bit OS'" Call Uninstall /NoInteractive
@Echo Removing LEAP PDF Registry Keys...
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LEAPAccountingPDFPrinter /f
@Echo Leap Uninstaller complete, Removing and Renaming Leap Files...
@Echo Off
@Echo ############## AppData Folder Local ##############
@Echo Delete: AppData/Local/LEAP
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\LEAP"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: AppData/Local/LEAP Office Installations
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\LEAP Office Installations"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: AppData/Local/LEAP_Legal
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\LEAP_Legal"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: AppData/Local/LEAP Desktop
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\LEAP Desktop"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: AppData/Local/LEAP_Legal_Software
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\LEAP_Legal_Software"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: AppData/Roaming/4D
@Echo Off
RD /S /Q "%userprofile%\AppData\Roaming\4D"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: AppData/Roaming/LEAP Legal Software
@Echo Off
RD /S /Q "%userprofile%\AppData\Roaming\LEAP Legal Software"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: AppData/Roaming/LEAP_Timesheet
@Echo Off
RD /S /Q "%userprofile%\AppData\Roaming\LEAP_Timesheet"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: AppData/Roaming/Microsoft/Word/startup/LEAP03automation.dtom
@Echo Off
RD /S /Q "%userprofile%\AppData\Roaming\Microsoft\word\startup\LEAP03automation.dotm"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo ################# Program Files #################
@Echo Off
@Echo Delete: Program Files/LEAP Office
@Echo Off
RD /S /Q "C:\Program Files\LEAP Office"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: Program Files/LEAP Legal Software
@Echo Off
RD /S /Q "C:\Program Files\LEAP Legal Software"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo ############## Program Files (x86) ##############
@Echo Off
@Echo Delete: Program Files (x86)/LEAP Office
@Echo Off
RD /S /Q "C:\Program Files (x86)\LEAP Office"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: Program Files (x86)/LEAP Legal Software
@Echo Off
RD /S /Q "C:\Program Files (x86)\LEAP Legal Software"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo ################# Temp #################
@Echo Off
@Echo Delete: Temp/4D
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\Temp\4D"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: Temp/LEAP
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\Temp\LEAP"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: Temp/LEAP_Legal
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\Temp\LEAP_Legal"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: Temp/LEAP_Cloud
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\Temp\LEAP_Cloud"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: Temp/LEAP_Desktop
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\Temp\LEAP_Desktop"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Delete: Temp/accdoc folder
@Echo Off
RD /S /Q "%userprofile%\AppData\Local\Temp\accdoc"
@Echo ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@Echo Full Uninstall complete.
@Echo Off
pause
exit虽然在运行脚本时没有创建output.txt,但这里遗漏了什么?我也尝试过添加脚本,在这个例子中,我在剩下的脚本中丢失了它,但是它不允许我发布它。
发布于 2018-08-08 01:45:16
call :out > "%~dp0output.txt"输出到与脚本相同的位置。call /?向您展示了要使用的修饰符。
作为管理员运行,前一个output.txt可能在system32文件夹中。
如果您也想输出stderr,请使用:
call :out > "%~dp0output.txt" 2>&12>&1将将stderr (2)重定向到stdout (1)的句柄。
https://stackoverflow.com/questions/51736924
复制相似问题