Jump to content


  • Posts

  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country


Everything posted by congnt92

  1. Hi, Gunsmokingman. I'm sorry. It work perfect. So problem come from copy-paste issue, not from your code. Thank you very much.
  2. Hi Mcinwwl, That's greate. And you're a Powershell professional, I guess you didn't really believe in yourself Just a question, how can I save it and use for batch file when i need a mix-method? Tks
  3. Try your code and work perfect. No temporarily file needed. Even your code is shorter. Tks Jaclaz
  4. Hi, Gunsmokingman First, Thank you for your enthusiasm. I try your vbs code with 2 USB devices plug on my PC but still .vbs say that no removable drives found. I do not know why i get this error. May come from copy paste issue. So can you please attach .vbs file for me. Tks
  5. Thank you for your clarification, dencorso. You're right. Text2.txt is output from batch code, i do not know why it is unicode .txt. But after your hint, i save it as ANSI to make sure again. Rerun .vbs code, it still return H: Removable Disk 4.0 GB I: Removable Disk 7.9 GB USB1 USB2 Why i need to outptut as H: Removable Disk 4.0 GB USB1 I: Removable Disk 7.9 GB USB2 Tks.
  6. I want to create a batch file with some wmic command to display USB driveletter, description, size, volume name. @echo off WMIC LOGICALDISK where drivetype=2 get caption,size,description,volumename > text.txt for /f "tokens=1-5 skip=1" %%a in ('type "text.txt"') do call :display %%a %%b %%c %%d %%e exit /b :display set drive=%1 set total=%4 set desc1=%2 set desc2=%3 set volname=%5 call :convertbytes total echo %drive% %desc1% %desc2% %total%>> text1.txt goto :eof : convertbytes REM run some command here to convert bytes to Gib ... But i have problems when using above code to display vol name. Because in some case vol name contain space then i do not know how to use for /f token (tokens can up to 6, 7, 8 even more). In case vol name contain space, then if we just using token 1-5, volname cannot fully display. Such as, FULL Vol name is : KINGSTON USB, then it only display KINGSTON. So to solved my problem, i split to output vol name to text2.txt, all the rest will output to text1.txt. Then i will merge text in 2 file (text1.txt, text2.txt) to one file (text3.txt). Finally i use TYPE command to display text3.txt. This is exactly i want to create this topic to get help from you. -------- My problem was solved by Jaclaz's batch code, by Mcinwwl's Powershell code, and of course Gunsmokingman's VBS code (but now I'm waiting his reply to edit *something* wrong may come from his typo). Tks all of you, Jaclaz, Mcinwwl, Gunsmokingman help me solve my problem. God bless you
  7. Thank you, gunsmokingman I tried your .vbs code but get this output. If you have a free time, can you recheck your code and see if there is any typo in it? Tks H: Removable Disk 4.0 GB I: Removable Disk 7.9 GB ÿþU S B 1 U S B 2 Also, just me make sure i'm copy your code completely. I upload your .vbs, too test_vbs.zip
  8. Tks for your reply. I do not know anything about powershell. I never use it before. i know that there are many ways that better than batch but I'm not good at coding then i always try to write some simple batch file to archive my goal. I tried with your method and it work very well. After I have text3.txt, i can display it in batch by type command. This method is "mixed" method: powershell and batch. I just have one thing make me worry that i do not know if powershell is always exists in all PC Windows or maybe winPE. Again, thank you very much.
  9. Hi Jaclaz, First i'm sorry. I just want to split my problem because if i post full my goal, then may be there are too much texts, and may be it make the reader quite difficult to know what extractly i need help. I tried your code and it work perfect. Also, as your advice, i edit #1 to full post and hope that if there is someone has same problem with me, it can help him/her. Again, thank you very much, Jaclaz.
  10. Hi all, EDIT: To avoid missmatch between Title and topic content, also to avoid a long post, I repost full my problem in post #9. I have 2 small .cmd file. Let say test1.cmd and test2.cmd test1.cmd creates text1.txt H: Removable Disk 4.0 GB I: Removable Disk 7.9 GB test2.cmd creates text2.cmd USB1 USB2 My goal is merger text in text1.txt with texts in text2.txt to new file (text3.txt) H: Removable Disk 4.0 GB USB1 I: Removable Disk 7.9 GB USB2 Here my way to do that but it repeat output many times @echo off for /f "tokens=*" %%a in ('type "text1.txt"') do ( for /f "tokens=*" %%b in ('type "text2.txt"') do echo %%a %%b) pause Can you help me correct my code? Tks
  11. Hi Jaclaz, I'm sorry for delay response. I use .cmd extension as you say. And i use winrar to create sfx.exe. Right click test.cmd >> add to archive >> tick create sfx archive check box >> goto Advanced tab >> choose SFX options path to extract: %windir% run after extraction: test.cmd mode: hide all advanced: admin access update: overwrite all files. My goal is: I create a winpe by winbuilder and i must to make sure test.cmd only run in my winPE. In system32, i have a tag file to help me detect if winpe was build by me or others. So in test.cmd i have some command like: if exist %windir%\system32\file.tag then do something, or if exist %windir%\system32\myreg.reg then import it .... Because test.cmd required some extra files so i want to create sfx.exe that will extract to %windir% then excute it from here. But problem come from here, run test.cmd normally it work fine but if put it to sfx then it say that file.tag not found, mean it's running from winpe that not build by me even i'm testing on my pe. Tks.
  12. Tks for your reply, submix8c After some works, I found that: On windows 64bits, %windir%\system32 is C:\windows\system32 if run test.cmd. But it will be C:\windows\sysWOW64 folder if run test.sfx.exe So after run test.sfx.exe and winrar call test.cmd, then test.cmd say that file.tag not found. May you will ask me: Why do you say that? Are you sure? Yes. I'm sure. Try with another test.cmd @echo offcopy C:\testfile.txt %windir%\system32\testfile.txtpausethen testfile.txt was copied to system32 folder. But if i create sfx exe by winrar, after test.cmd extract and run, it copy testfile.txt but to SysWow64 folder. So can you give me some hints how can I create sfx.exe that can be use on both 32 and 64bits. Tks.
  13. Hi Yzöwl, submix8c I have same issue with Alystinn. . I have a .bat and i want to convert it to test.exe which run on both 32 and 64bits OS If i run test.bat then it work fine, but if i run test.exe then bat fail. Here my test.bat (file.tag put at system32 folder but test.exe return not found) @echo offif exist %windir%\system32\file.tag echo found! && pause && exitecho not found!pauseexitI'm using WinRAR 64bits trail version to make sfx .exe and I run .exe on 64bits OS. Can you give me some advices? Tks
  14. Try KMG2B.cmd, work perfectly. But if put it in directory which contain space in path it'll error. You may add some double quote for general use. Tks
  15. Oh i'm do not know about osloader or bootsector in bcdedit command. I think that grubx64.efi just like grldr but grldr config menu.lst, grubx64.efi config grub.cfg. I try with bcdedit add grubx64.efi before but no luck. Not remember exactly what error, but it fail on windows boot manager, I will try again and will report detail error. tks for your given links
  16. I doubt always, very often it's disk 0.A user may change UEFI boot order: current running windows disk 0, second disk 1 The user changes the boot order: next boot is not from previous windows disk Possible execeptions Kansas chity shuffle http://www.911cd.net/forums//index.php?showtopic=21242 Machines with chipset storage and addional esata, msata or m.2 connector Imagine at two disk: given one EFI system partiton. You add a file this single EFI system partiton. The end user boot another OS next, creates a second EFI system partiton at the second hard disk. And boots from second hard disk next. Your file is missing at active EFI system partiton I don't understand the requirements still. Machinbe booted at BIOS? Machinbe booted at BIOS? What about EFI NVRAM settings? Remember, if you boot from UEFI, then mountvol solves your basic issue. Given the end user keeps the UEFI disk order. A real world simplification: If a disk 0 contains a EIF system, then use this. Ignore strange cases. By the way: At booted PE may reset SystemSetupInProgress settings, e.g. printer support Tks for your detail info. My goal: - At legacy bios, we can add a menu entry to boot.ini or BCD - At uefi, we can add menu to BCD but i do not know why it can not work quote from .bat (S: is EFI partition which mount by your method) But it fail at Windows Boot manager. I guess that boot ubuntu.efi file from BCD is impossible. But this method work with memtest.efi. So may must be signed .efi ?? So i think that, i must replace bootx64.efi from Microsoft with bootx64.efi from ubuntu, then bootx64.efi from ubuntu config file grub.cfg, with grub.cfg i have a menu that chainload to bootfw.efi to boot windows and a menu to boot Live Ubuntu. By this method, i can dual boot windows and linux. And to copy bootx64.efi from ubuntu to EFI partition, I need a .bat to do this. You and Jaclaz help me solved it. My .bat request: User must run .bat from real UEFI windows (not PE).
  17. Tks for your info, i will try and report result.
  18. Oh i do not know that. I found this reg key from internet and even do not understand it work for general way or not. Can you give me some other ways simpler and quicker ??
  19. Tks for your help. Let me say about my goal. I'm creating a multiboot which contain: winpe, ubuntu (live, not install to harddisk). It will work on UEFI and LEGACY. -WinPE is thin ver, and I create ToolsforPE.ISO then after boot to WinPE, I use .bat to mount it. (this is reason why I create a topic about For /f command and solved with Jaclaz's help) -with uefi computer, i need .efi file to boot then i need a .bat which mount EFI partition then copy some .efi to it, then chainload them by grub2. this is reason why i create a topic about order partition -ubuntu live and persistence need a file call: casper-rw with ext2 format. And i must create a "empty" file by fsutil then use mke2fs convert it. since fsutil create a file base on kb in size bytes in size, then i get problems with .bat because it limit number. Jaclaz give a link to download useful tool which create exactly size in Gib. Because I use .bat for all of 3 task above then I do not know if i can use PowerShell in .bat or not.
  20. Hi, I repost this to get some advices from you. Cdob's method seem work in most case, even if user run .bat from WinPE (not yet tested) But for safety reason, i just want user run .bat from real windows. I found a useful reg key to check if user boot from winpe or not HKLM\SYSTEM\Controlset001\Control\SystemStartOptions If boot from winpe, that say Win7PE then it will show ..\Win7PE.Wim so i use reg query command then use findstr /r "WIM", if not error then user boot from winpe. Since LiveXP use .wim boot method then I think this will work with LiveXP, too. But just to make sure, I want to ask you if it's good method or we can use another method to detect. Tks
  21. Would you think that the title of The Finder was arbitrary? (please note the capital T and F ) And of course, it's a state secret ...: http://www.literaturepage.com/read.php?titleid=man-in-the-iron-mask&abspage=294 jaclaz Oh, I see. You're "google" guy. So if i can not found something on internet, may i will ask for your help . Thanks again for your help in almost my topic. God bless you
  22. Update: mkfile create file exactly size in Gib and very quickly. Greate. Tks Jaclaz.
  23. I know about sel, par but not know what does det mean. Now you explain it. Tks.
  24. Greate. I'll try it now. Tks for your useful tool. And how can you know these tool. It seem quite "hidden" on internet. I try googled many times but not found some tools like this.
  25. Tks for your explain, Jaclaz. About command to make a ext2 file, i found it from RMPrepUSB (steve use fsutil vs mke2fs, too, but not extactly size). Also i don't want use RMPrepUSB just create a ext2 file. Since we have fsutil and light weight tool mke2fs.exe we only need one thing, a .bat file to do that. I found that, we can create a "empty" file (not sure) with dd for windows. But still it is not exactly size as we want. I will try your .bat from reboot then see if i can use some code from it for my case. Tks
  • Create New...