Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Feb 2015
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile request for a few silent batch scripts i require for w7,thanks

    ive tried to wrap my head around silent batch scripting but i just cant do it , suffice to say ive got a few silent batch file requests as following>


    1. silent batch file for automatically setting a background at windows startup in windows desktop depending on week of the year , that being from week 1-52

    all backgrounds are sorted into theyre respective week folder and the week subfolders are in a main folder called weeklybackgrounds which sits in the main root, accordingly like so >

    c:
    weeklybackgrounds >
    week1
    week2
    week3
    .....and so on

    and the background image files are randomly named


    2. a silent batch file for automatically disabling and reenabling the microsoft loopback adapter , since ive noticed it to not enable internet access until i disable it and reenable it if i restart my pc , it seems it doesnt flush its previous networking state or such


    thanks in advance

  2. #2
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,420
    Thanks
    33
    Thanked 195 Times in 175 Posts
    A couple of interesting questions!

    1) it should be possible to change the background / wallpaper from a BATch file only if the image files are .BMP - not .JPG/.JPEG. Another comment I read is that the method works in XP but might not in Windows 7.

    Try the following on your machine, and see if it works:
    Code:
    To change windows desktop wallpaper what we normally do is right click on the desktop and go properties and so… But we can do the same by editing registry key using reg command from command line. The command is given below.
    
    reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d  wallpaper_path /f
    
    For example to set the image E:\photos\image1.jpg as the wall paper we need to run the command as below.
    
    reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d E:\photos\image1.bmp /f
    
    After editing the registry key we need to run the below command to make the change take effect immediately.
    
    RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
    
    Note that this method works only for bmp images. If you have .jog or .jpeg images you can’t set them as wallpaper from command line. You can use the Desktop settings UI to set a .jpg or .jpeg file as wallpaper.
    2) I don't have a "Microsoft loopback connector" shown in my Windows 7 Network Connections, and to be honest I've never come across it before. Have you tried disabling it and not re-enabling it?
    BATcher

    Time prevents everything happening all at once...

  3. #3
    New Lounger
    Join Date
    Feb 2015
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @2 well of course you dont have a Microsoft loopback adapter installed by default you have to add it through the device manager , mind you the loopback adapter is a virtual ethernet adapter , used by such things as virtualbox for internet connectivity bridging from vms and so on , and disabling and not reenabling it would defeat its purpose of enabling internet access , lols


    your solution to 1 , wont do the trick , why ? , ill explain >

    i need the background images to apply depending on what week we have , say were in week 2 ..3.. or 50 , the batch has to be able to check the date in windows and autoset the background on startup, mind you the backgrounds i use are actual .mpg/.wmv clips , yes i use dreamscene, but this little bit of extra info on what exactly kind of images or clips i use should be irrelevant , since the script should be able to set .mpg, .wmv , .jpg , .jpeg , .png , .bmp , files as background without a hitch anyhow

    so above method will not suffice , you see this requires advanced batch skillz , hence why ive made this request in the first place and hope you can come up with a solution to 2, thanks in advance
    Last edited by classictech; 2015-02-22 at 19:19.

  4. #4
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,420
    Thanks
    33
    Thanked 195 Times in 175 Posts
    I don't think I explained my answer to problem 1 sufficiently! I was wanting you to try a specific instance of a wallpaper / background file on your own machine. If it doesn't work (and you can try it for all filetypes you mention - with care), then there is no point devising a mechanism for choosing a file depending on the week number!

    This problem has no easy answer, and may have no answer at all for filetypes apart from BMP.

    For problem 2, set up a Command Prompt window in Administrator mode and try:
    netsh interface set interface name="Microsoft Loopback Adapter" admin=disabled
    netsh interface set interface name="Microsoft Loopback Adapter" admin=enabled

    (check that the name is correct!)

    If these commands work, then it would be fairly easy to set up a scheduled task to cause the BATch file to run at logon time.
    But, as before, there's no point doing this until you're sure the basic commands work!
    BATcher

    Time prevents everything happening all at once...

  5. #5
    New Lounger
    Join Date
    Feb 2015
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok so the commands work for the loopback adapter , so now what do i do? btw ive done the above command for the background step by step , and it dont do anything not even for .bmp images , since its supposedly supposed to switch the background instantly , nope still got the old dreamscene background here , didnt do nothin except change the wallpaper destination in the registry from C:\Users\tech\AppData\Roaming\Microsoft\Windows DreamScene\DreamScene.jpg to C:\weeklybackgrounds\week 21\234234.jpg , mind you the dreamscene.jpg is a normal beahvior of w7 using dreamscene mpg or wmv clips , anyone that uses dreamscene in w7 knows what im talking about , and if you say batch cant do a background change such as what you can do with a simply right click of the mouse and selecting the image or clip you want as background , im quite confused , from what ive heard theres pretty much nothing you cant do with batch scripts , or even more powerfull scripts such as powershell scripts or even autoit scripts
    Last edited by classictech; 2015-02-24 at 18:36.

  6. #6
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,420
    Thanks
    33
    Thanked 195 Times in 175 Posts
    Just to check: you did run the RUNDLL32 command following the REG ADD command? If not, nothing would happen until the next logoff/logon (or perhaps even reboot). That's even if it happens at all!

    With the NETSH commands, you need to put them in a BATch file, then set up a task in Scheduled Tasks so that the BATch file is run at Logon time. If you're not familiar with the Task Scheduler/Scheduled Tasks that could be a problem because it's a steep learning curve. This tutorial from Seven Forums shows how to run CCleaner from a scheduled task; you would need to modify this to run instead the BATch file.

    BATch files cannot do everything available via the GUI; Powershell is more modern and capable, but the same still applies.
    BATcher

    Time prevents everything happening all at once...

  7. #7
    New Lounger
    Join Date
    Feb 2015
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes ive ran this command after following the reg add command> RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters nothing happened except the Wallpaper destination changing in the wallpaper reg entry under current user so what your saying is autoit script would be required for my background autoscript ive requested? and thanks for the commands ill find the silent execution commands to add to this , btw why mess with scheduled tasks just create a shortcut to the batch and put it in the startup folder , that will do the trick, i recon
    Last edited by classictech; 2015-02-26 at 06:49.

  8. #8
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,420
    Thanks
    33
    Thanked 195 Times in 175 Posts
    I think you will need to go the AUTOIT route for problem 1, if the other option does not work for you.

    Yes, the Start folder is a useful place to have tasks run at Logon time. I personally prefer scheduled tasks because of the considerable degree of flexibility afforded by its myriad options.
    BATcher

    Time prevents everything happening all at once...

  9. #9
    New Lounger
    Join Date
    Feb 2015
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes i thought so , ive already opened up a thread over at theyre forums for problem 1

    well thats all nice and good but scheduled tasks isnt really required for my simple function batch , i can see how it may be usefull for more complex startup processes thou

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •