标题: [系统相关] bat转换sh在linux中执行 [打印本页]
作者: ihubert 时间: 2018-9-10 13:23 标题: bat转换sh在linux中执行
请问.bat的批处理文件如何在linux下执行。具体如下:- @echo off
- setlocal EnableDelayedExpansion
- echo VirtualBox Hider for SolidWorks
- echo by TeAM SolidSQUAD-SSQ
- if "%1"=="" goto usage
- set VMNAME=%1
- VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVendor" "American Megatrends Inc"
- VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVersion" "2.1.0"
- VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor" "ASUSTek Computer"
- call:gen_random_string 9
- VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "string:!rand!"
- call:gen_random_string 20
- VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/Port0/SerialNumber" "string:!rand!"
- call:gen_random_string 8
- VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Port0/FirmwareRevision" "string:!rand!"
- VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Port0/ModelNumber" "SEAGATE ST3750525AS"
- echo.
- echo Success!
- echo.
- pause
- goto:eof
- :usage
- echo Usage: %0 VM-Name
- echo This script shold be started from HOST machine
- echo where VM-name is a name of STOPPED VirtualBox virtual machine
- echo Note: the PATH variable must contain path to VBoxManage.exe
- echo like set PATH=C:\Program Files\Oracle\VirtualBox;%%PATH%%
- echo.
- pause
- goto:eof
- :gen_random_string
- set lineup=0123456789ABCDEF
- set RandomLength=%1
- set count=0
- set rand=
- :loop
- set /a count+=1
- set /a_RND=%Random%*15/32768
- set rand=!rand!!lineup:~%_RND%,1!
- if !count! lss %RandomLength% goto loop
- :eof
复制代码
作者: Batcher 时间: 2018-9-10 13:56
BAT是无法在Linux里面执行的,需要找个懂sh而且知道你想实现什么功能的人把代码重写一遍。
作者: ihubert 时间: 2018-9-10 16:48
我连现在的bat都没看太明白。。。
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |