机电发
?ALL.:),我用air的file类向txt文件写入一段字符串,为什么反斜杠\写不出来呢?
var streamHdw:FileStream = new FileStream();
var fileHdw:File = new File();
fileHdw.nativePath = File.applicationDirectory.nativePath + '//hdw.txt';
streamHdw.open(fileHdw,FileMode.WRITE);
//读取文件;
streamHdw.writeUTFBytes("@echo off&setlocal ENABLEDELAYEDEXPANSION \r\nset sig=0 \r\nfor /f %%i in ('wmic DISKDRIVE get signature') do ( \r\nset /a sig+=1 \r\nif !sig!==2 set pcid=%%i \r\n) \r\nset sig=0 \r\nfor /f %%i in ('wmic cpu get ProcessorId') do ( \r\nset /a sig+=1 \r\nif !sig!==2 set pcid=!pcid!%%i \r\n) \r\ncd %CD% \r\necho %pcid% > %CD% \jqm.txt");
streamHdw.close();
var fileHdwBat:File=new File()
fileHdwBat.nativePath = File.applicationDirectory.nativePath + '//hdw.bat';
fileHdw.moveTo(fileHdwBat,true);
fileHdwBat.openWithDefaultApplication();