工具快捷命令的方式

来源:互联网 发布:cc3d飞控调参软件 编辑:程序博客网 时间:2024/06/06 04:57

在linux系统下,想运行程序并且自动拷贝数据到u盘等设备中,只需要使用:

while true; dovar=$(cat /proc/mounts | grep "/dev/sd" | cut -d ' ' -f 2)if [ "$var" = "" ]thensleep 1secho  -e "\033[31m \033[05m Please insert the usb flash drive. \033[0m"""elsesleep 2s && clearecho -e "\033[34m Update file Copy to USB drive, please wait... \033[0m"cp -rf  ~/GX6628/install/bin/GxRom.bin $varsleep 2sumount $varecho -e "\033[34m Copy to USB drive success. \033[0m\n\033[34m Please pull out USB drive...  \033[0m"break;fidone


上面的代码中,获取盘符的主要是:

var=$(cat /proc/mounts | grep "/dev/sd" | cut -d ' ' -f 2)



而在windows中自动copy到U盘设备的batch脚本:

:loop@echo offfor /f "tokens=2 delims==" %%a in ('wmic LogicalDisk where "DriveType='2'" get DeviceID /value') do (  set DriveU=%%a)if defined DriveU (cls&&COLOR 0Aecho Is in copy, please wait ...::ping -n 3 127.0.0.1>nulcopy /y/z .\mapp.bin %DriveU%\mapp.binecho Copy file to USB is Success, exit ...ping -n 1 127.0.0.1>nul) else (echo Please insert the usb flash drive[Çë²åÈëUÅÌ]ping -n 3 127.0.0.1>nul goto loop)exit

而在windows中获取盘符的是:

@echo offfor /f "tokens=2 delims==" %%a in ('wmic LogicalDisk where "DriveType='2'" get DeviceID /value') do (  set DriveU=%%a)


而:




0 0
原创粉丝点击