Jump to content

congnt92

Member
  • Posts

    128
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Vietnam

About congnt92

  • Birthday 09/16/1996

Profile Information

  • OS
    Windows 7 x86

Recent Profile Visitors

2,564 profile views

congnt92's Achievements

16

Reputation

  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
×
×
  • Create New...