[Batch] The Official Batch File Repository - Learn & ask questions about batch files

Discussion in 'Scripting' started by timesurfer, Oct 11, 2010.

  1. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,513
    7,174
    120
    #221 Josh Cell, Nov 8, 2011
    Last edited by a moderator: Apr 20, 2017
    Backup Code

    Code:
    @ECHO OFF
    echo Killing the OSPPSVC SERVICE PROCCESS
    net stop osppsvc>NUL
    taskkill /IM "osppsvc">NUL
    echo Copying Tokens.dat File to Desktop
    MD "%USERPROFILE%\Desktop\Backup">NUL
    COPY /Y "%PROGRAMDATA%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat" "%USERPROFILE%\Desktop\Backup\tokens.dat"
    echo Copying Cache.dat File to Desktop
    COPY /Y "%PROGRAMDATA%\Microsoft\OfficeSoftwareProtectionPlatform\Cache\cache.dat" "%USERPROFILE%\Desktop\Backup\cache.dat"
    net start osppsvc >NUL
    Restore Code

    Code:
    @ECHO OFF
    echo Killing the OSPPSVC SERVICE PROCCESS
    net stop osppsvc>NUL
    taskkill /IM "osppsvc">NUL
    echo Restoring Tokens.dat File
    COPY /Y  "%USERPROFILE%\Desktop\Backup\tokens.dat" "%PROGRAMDATA%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat">NUL
    echo Restoring Cache.dat File
    COPY /Y  "%USERPROFILE%\Desktop\Backup\cache.dat" "%PROGRAMDATA%\Microsoft\OfficeSoftwareProtectionPlatform\Cache\cache.dat">NUL
    net start osppsvc >NUL
    ;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. calpo

    calpo MDL Member

    Apr 23, 2010
    212
    60
    10
    @ Josh Cell

    I wonder if we can use command line to backup product key of Office 2010 and Windows 7 or not ? If it's possible ... can you tell me how to please ?

    Thanks for your help.
     
  3. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,513
    7,174
    120
    Impossible with batch compilation, only using external APP's ;

    And the results isn't good, if the Key is retail, even show wrong product key, the full method for it is extracting the key at WMI and confirm if equals in the Decoder ...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. calpo

    calpo MDL Member

    Apr 23, 2010
    212
    60
    10
    Thanks a lot for your info.

    Have a good day.
     
  5. calpo

    calpo MDL Member

    Apr 23, 2010
    212
    60
    10
    #225 calpo, Nov 10, 2011
    Last edited by a moderator: Apr 20, 2017
    @ Josh Cell

    Just a question for Backup Code

    Correct me for the wrong or missing command line.

    I added command line ( Press any key to open the Backup folder .... ) as below .. it can not open the Backup folder when I press any key.


    Code:
    @ECHO OFF
    set f="%USERPROFILE%\Desktop\Backup"
    echo Killing the OSPPSVC SERVICE PROCCESS
    net stop osppsvc>NUL
    taskkill /IM "osppsvc">NUL
    echo Copying Tokens.dat File to Desktop
    MD "%USERPROFILE%\Desktop\Backup">NUL
    COPY /Y "%PROGRAMDATA%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat" "%USERPROFILE%\Desktop\Backup\tokens.dat"
    echo Copying Cache.dat File to Desktop
    COPY /Y "%PROGRAMDATA%\Microsoft\OfficeSoftwareProtectionPlatform\Cache\cache.dat" "%USERPROFILE%\Desktop\Backup\cache.dat"
    net start osppsvc >NUL
    echo.Press any key to open the Backup...&pause>nul
    start %f%
    

    Thanks in advance.
     
  6. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,513
    7,174
    120
    #226 Josh Cell, Nov 11, 2011
    Last edited by a moderator: Apr 20, 2017
    Code:
    @ECHO OFF
    echo Killing the OSPPSVC SERVICE PROCCESS
    net stop osppsvc>NUL
    taskkill /IM "osppsvc">NUL
    echo Copying Tokens.dat File to Desktop
    MD "%USERPROFILE%\Desktop\Backup">NUL
    COPY /Y "%PROGRAMDATA%\Microsoft\OfficeSoftwareProtectionPlatform\tokens.dat" "%USERPROFILE%\Desktop\Backup\tokens.dat"
    echo Copying Cache.dat File to Desktop
    COPY /Y "%PROGRAMDATA%\Microsoft\OfficeSoftwareProtectionPlatform\Cache\cache.dat" "%USERPROFILE%\Desktop\Backup\cache.dat"
    net start osppsvc >NUL
    echo.Press any key to open the Backup...&pause>nul
    EXPLORER "%USERPROFILE%\Desktop\Backup"
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. calpo

    calpo MDL Member

    Apr 23, 2010
    212
    60
    10
    @ Josh Cell

    It works ....:p Thanks again.
     
  8. milpi

    milpi MDL Novice

    Nov 23, 2011
    4
    0
    0
    @ Josh Cell

    Can you correct me something I'm wrong :worthy:

    I want to rename a file ( wpa.dbl to wpa.dbl.bak ) in Windows XP
    Here's my command line in .cmd

    REN "%WINDIR%\System32\wpa.dbl wpa.dbl.bak"

    It said that the syntax of the command is incorrect as I run.

    I try different way. It does not work too.

    REN "%WINDIR%\System32\wpa.dbl wpaold.dbl"

    Thanks so much for your help.
     
  9. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,513
    7,174
    120
    #229 Josh Cell, Nov 23, 2011
    Last edited by a moderator: Apr 20, 2017
    Try this:

    Code:
    REN "%WINDIR%\System32\wpa.dbl" "wpa.dbl.bak"
    Not works if the file is protected by system ...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. milpi

    milpi MDL Novice

    Nov 23, 2011
    4
    0
    0
    #230 milpi, Nov 23, 2011
    Last edited by a moderator: Apr 20, 2017
    Thanks, It works
     
  11. ItielMaN

    ItielMaN MDL Senior Member

    Apr 30, 2011
    367
    59
    10
    I need to get the exact location of a process name that a scheduled job is executing. I want to use WMIC JOB (if you have any other better suggestions.. let me know) to get that, but I don't know HOW exactly. I've tried several variations but no luck so far.

    How should I do it?

    Thanks.
     
  12. ItielMaN

    ItielMaN MDL Senior Member

    Apr 30, 2011
    367
    59
    10
    Someone? :<
     
  13. ItielMaN

    ItielMaN MDL Senior Member

    Apr 30, 2011
    367
    59
    10
  14. ItielMaN

    ItielMaN MDL Senior Member

    Apr 30, 2011
    367
    59
    10
    Please <_<
     
  15. ItielMaN

    ItielMaN MDL Senior Member

    Apr 30, 2011
    367
    59
    10
    Up up up...
     
  16. ItielMaN

    ItielMaN MDL Senior Member

    Apr 30, 2011
    367
    59
    10
    Nobody knows?
     
  17. sanjose

    sanjose MDL Member

    Jan 23, 2012
    184
    21
    10
    #237 sanjose, Mar 29, 2012
    Last edited by a moderator: Apr 20, 2017
    Hello Everyone,

    I have some problem with command lines. Please help me correct them.

    I want to create a file Start.cmd (start /wait ) to install some softwares with one click on start.cmd.

    How can I SKIP click NEXT as it's installing .... see below. It asks me to click NEXT to continue .... and does not install the file Register.reg

    Code:
    @echo off
    
    ECHO.
    ECHO Installing Easy CD-DA Extractor
    ECHO Please wait...
    start /wait %systemdrive%\install\Applications\EASYCD\Setup.exe /s 
    ECHO.
    ECHO Registering Easy CD-DA Extractor
    REGEDIT /S %systemdrive%\install\Applications\EASYCD\register.reg
    

    [​IMG]


    Thanks for your help.
     
  18. Tito

    Tito Super Mod / Adviser
    Staff Member

    Nov 30, 2009
    18,823
    19,035
    340
    The setup is built using Indigo Rose Setup Factory, so see here. :)
     
  19. urie

    urie retired mod

    May 21, 2007
    8,999
    3,381
    300
    The Silent install switch for Setup factory 8 programs is /S but it needs to be enabled when they build the installer it is not enabled in Easy CD-DA Extractor setup.exe

    Just install it, configure it the way you want and grab the folder from program files and the registry keys under Software/Poikosoft.

    You can make an SFX archive for it.
     
  20. sanjose

    sanjose MDL Member

    Jan 23, 2012
    184
    21
    10
    #240 sanjose, Apr 12, 2012
    Last edited by a moderator: Apr 20, 2017
    Hi All,

    I want to create a Command file . cmd to install Cert & OEM SLP Key for Windows 7 . I search around and found a Command Line for product key only. I can not find a command line for Cert. Here's what I did ...

    I create a folder and put HP Cert & a file .cmd in that folder.

    [​IMG]

    My command line in Activate.cmd is

    Code:
    @echo off
    cls
    echo    Activate Windows 7... 
    echo.
    cscript //B "%windir%\system32\slmgr.vbs" /ipk MHFPT-8C8M2-V9488-FGM44-2C9T3
    cscript //B "%windir%\system32\slmgr.vbs" /ato
    Now I need a command line to install HP.xrm-ms as I run Activate.cmd

    Please anyone help me have a command line to install HP.xrm-ms as I need activate HP Windows 7 with SLIC 2.1

    I've known that we can use CMD to install Cert & Key such as

    slmgr -ilc C:\HP.xrm-ms
    slmgr -ipk MHFPT-8C8M2-V9488-FGM44-2C9T3

    But All what I need to right click the file .cmd Run as admin to activate Windows 7.

    Thanks for your help in advanced.