need help with sfx and batch

Discussion in 'Software' started by red death68, Jun 30, 2010.

  1. red death68

    red death68 Command Sergeant Major

    ok so i got a sfx archive im setting to write files to temp directory but i want it to remove said files when batch the sfx is running closes i need help

    the directory is
    C:\Temp
    so id like to keep the directory itself intact but get rid of files and folders within the directory also if at all possible id like it not to show that it deleted the files from the directory to stop uneccisary questions from people who are going to be using this batch

    PS:its not important why i want it to do this but if i must explain for help then i will
     
  2. GermanOne

    GermanOne Guest

    My personal batch trainee again ;)

    *** snipp
    Code:
    pushd "C:\Temp" ||goto :eof
    del /s /q *.* >nul
    for /d %%a in (*) do rd /s /q "%%a"
    popd
    
    *** snipp

    Regards
    GermanOne
     
  3. red death68

    red death68 Command Sergeant Major

    thnx alot german i figured youd respond so if i past this line into a batch file it will delete cointents of c:\Temp and leave the folder itself intact

    lol i realy should click the thanks button more often for you lol
     
  4. red death68

    red death68 Command Sergeant Major

    sorry for double post but it wouldnt let me edit

    it works great until packeged in an sfx archive like i wanted then certain parts of the batch get omited such as my credits and it leaves the folder structer in C:\Temp intact but removes all files in the folder any suggestions if it helps heres the batch i have to far

    and sadly it wasnt all my doing its a mod of a mod from a friend
     
  5. theefool

    theefool Geekified

    So, the batch runs fine by itself, yes?

    Also, where you have *.*** you only need *.*

    Well, for example:

    XCOPY "%ProgramFiles%\Z8Games\CrossFire\rez\UI\Mark\*.***" "C:\Program Files\Z8Games\CrossFire\rez\UI\Mark\Mark Backup\*.***" /Y /q

    only needs to be:

    XCOPY "%ProgramFiles%\Z8Games\CrossFire\rez\UI\Mark\*.*" "C:\Program Files\Z8Games\CrossFire\rez\UI\Mark\Mark Backup\" /Y /q
     
  6. theefool

    theefool Geekified

    In addition you can add more set commands, so instead of typing out "C:\Program Files\Z8Games\CrossFire\rez\UI\Mark\

    you can set a variable to it, example:

    set target="C:\Program Files\Z8Games\CrossFire\rez\UI\Mark\

    Then use %target% to call that variable.
     
  7. GermanOne

    GermanOne Guest

    theefool is right.

    What file extensions do your credits have? (As you know I don't play computer games.)


    Strange. Exchange:
    Code:
    for /d %%a in (*) do rd /s /q "%%~a"
    
    Regards
    GermanOne
     
  8. theefool

    theefool Geekified

  9. red death68

    red death68 Command Sergeant Major

    ok the extra * could been a mis type
    the credits are the part of batch that say

    i know but it was easier to copy and paste the path

    yes it runs fine by itself and i have tried batch to exe befor didnt care for it and the sfx is ideal because it can hold the files that need to be moded as well as the batch that i need to install mods plus it houses the uninstall which will be placed on desktop

    so what am i changing? is it the line
    for the line
     
  10. red death68

    red death68 Command Sergeant Major

    good news i think i found a solution

    check this code it works so far the only downside is it still likes to skip my credits but heres code my solution was to specify the sub directories that i needed delted individualy and then the left over files let me know what you think

     
  11. red death68

    red death68 Command Sergeant Major

    hey guys fully fixed it found the problem when it deleted the contents of c:\Temp it was deleting the batch which is why it was skipping my credits but ty both for all your help
     
  12. red death68

    red death68 Command Sergeant Major

    dude dont spam
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds