@echo off @title ssh key install setlocal enabledelayedexpansion rem set destinationFilPath C;\myfolder set destinationFilPath=C;\myfolder rem show sourceFilePath echo param is %1% rem set sourceFile set sourceFile=%1% echo sourceFile is %sourceFile% rem check file if not exist %sourceFile% ( echo file dose not exist exit ) rem copy file to destinationFilPath xcopy /Y %sourceFile% %destinationFilPath% if !errorlevel! neq 0 ( echo copying file failed... echo !errorlevel! exit ) rem add space into authorization echo.>>%destinationFilPath%\authorization_file rem get file name for %%a in ("%sourceFile%") do ( set var=%%~nxa ) echo file name is %var% rem add permission into authorization echo Key %var%>>%destinationFilPath%\authorization_file if !errorlevel! neq 0 ( echo adding authorization into failed... echo !errorlevel! exit ) echo install successfully exit
@echo off set filePath=D:\Program Files\VMware\vmware.exe ::有/P参数时,是需要手动输入,去掉后,即为固定。 for %%a in ("%filepath%") do ( set str=%%~pda set var=%%~nxa ) echo.路径为:%str% echo.文件为:%var% pause
版权声明:本文为qq_35889665原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。