请问.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
复制代码
|