Getting a Batch File to run a VBScript

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
Arbitar
DBB Ace
DBB Ace
Posts: 186
Joined: Sun Apr 04, 2004 1:49 am

Getting a Batch File to run a VBScript

Post by Arbitar »

'Allo all!
Arbitar is here with a problem, and since you all are a smart punch of people, I thought you might be able to help.
Ok, best start wtih why I'm trying to do what I'm trying to do.
Short Version: Becasue I want to.
Long Version: Ok. My school is very ... tech based. It has lots of comptuers, and I spend half my day (2 periods) infront of comptuers. Well, they have plenty of restrictions, and I dont might that, except for one. They block access to the display control panel from some reasons, so you cant change the desktop. But I found a need to becasue the desktop by default it a ugly shade of GREEN with the school logo and XP logo. Ew. So I quickly found that if you replace a file in my user folder with a 1024x768 bmp names "Wallpaper1.bmp", it will change the wallpaper to that. SO on my desktop I set up a shortcut, and whenever I log in, I drag "Wallpaper1.bmp" to the folder, and refresh the desktop to get my background.
After a while though, that started feeling like too much work. So I set out to automate the procedure. So far its been good and I'm able to toally automate it. Except for one part.

I created a batch file (as previously stated) that automatically copies Wallpaper1.bmp on my desktop, to the correct folder, overwriting it if it already exists. Then I just need to refresh the desktop. I wrote a small vbscript (also previously stated >_<) to do this, and it works fine when I normally double click on it. Well, I need it to be totally automated, as previously stated, and so .. I set out to execute that special refresh.vbs from my batch file (automated commandline, in essence ^_^). Well, I sucsessfully had the batch file copy "Wallpaper1.bmp" to "C:\Documents and Settings\(username contains my name, ommited)\Application Data\Microsoft", and then had it navigate to the Other folder, where my vbs was, and had it try to execute my refresh.vbs. BZZZZ problem time.

It would work. It wouldnt execute and refresh. I tried the command, plain, "refresh.vbs", and i tried "call wscript refresh.vbs" and "call cscript refresh.vbs" and desperatly "call refresh.vbs".

Any ideas on how to execute my refresh.vbs from Set Background.bat?

Any help will be appreciated. Thanks ^_^ I'm rather stumped.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

Hmm. "wscript refresh.vbs" worked just fine for me. Try that. If it still appears to not work, intentionally create an error in the VBScript program and run the batchfile again. If no error box shows up, then there's a problem with the "wscript" command. If an error box does show up, I hate to tell you that it's a problem with your program.

Oh, and I'm gonna edit the title of your post to be somewhat meaningful.
Arbitar
DBB Ace
DBB Ace
Posts: 186
Joined: Sun Apr 04, 2004 1:49 am

Post by Arbitar »

Ok, results are:
Error created.
No messagebox or any kind of alert saying there was an error.
:|
Maybe I had better find some other way to do this ...
Arbitar
DBB Ace
DBB Ace
Posts: 186
Joined: Sun Apr 04, 2004 1:49 am

Post by Arbitar »

Ok, I got it figured out. I did it all in a batch file, using different system commands. ^_^
Post Reply