MSFN Forum: Which Script Variable to use with Windows 7 Install - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Which Script Variable to use with Windows 7 Install Rate Topic: -----

#1 User is offline   AmazingGecko 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 07-November 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 19 December 2012 - 08:32 AM

After reading several threads and posts I need some clarification on the following:

I want to use a script that will tell WPI to execute after it installs all my apps that will remove all the desktop shortcuts. The general thought is to use -

del /s/q "%allusersprofile%\Desktop\*.lnk"

However, research on the web says that the variable %allusersprofile% has changed in Windows 7 to %programdata%. Can anyone confirm this and if so does the rest of the script change in any way?

James


#2 User is offline   myselfidem 

  • Member
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,392
  • Joined: 06-January 10
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 19 December 2012 - 09:52 AM

You can use:

DEL "%SystemDrive%\Users\Public\Desktop\*.lnk"


#3 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 19 December 2012 - 10:28 AM

View Postmyselfidem, on 19 December 2012 - 09:52 AM, said:

You can use:

DEL "%SystemDrive%\Users\Public\Desktop\*.lnk"


Shorter!
%PUBLIC%\DESKTOP


#4 User is offline   myselfidem 

  • Member
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,392
  • Joined: 06-January 10
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 19 December 2012 - 11:07 AM

Nice! Thanks :)

#5 User is offline   AmazingGecko 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 07-November 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 19 December 2012 - 06:22 PM

Thanks guys!

Will try that later today and post my results.

#6 User is offline   AmazingGecko 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 07-November 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 20 December 2012 - 06:35 AM

Ok, tried the following scripts:

DEL "%PUBLIC%\DESKTOP\*.lnk"

DEL "%SystemDrive%\Users\Public\Desktop\*.lnk"

del /s/q "%allusersprofile%\Desktop\*.lnk"


and it fails every time with the returned code:

(returned code 999)

Any ideas?

This post has been edited by AmazingGecko: 20 December 2012 - 06:47 AM


#7 User is offline   AmazingGecko 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 07-November 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 20 December 2012 - 07:28 AM

I've noticed others also having issues with using this script but when inserted into a bat file and run it worked fine. I have no experience with writing bat files but if someone could give me some pointers on what and where to save it I'm sure I could resolve this.

#8 User is offline   myselfidem 

  • Member
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,392
  • Joined: 06-January 10
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 20 December 2012 - 09:13 AM

Could you attach your config.js file please?

Or check the installation path for your batch file!

This post has been edited by myselfidem: 20 December 2012 - 11:07 AM


#9 User is offline   AmazingGecko 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 07-November 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 21 December 2012 - 04:59 PM

Decided to teach myself how to write a .bat file and hey presto - it now works!

@echo off
REM Deleting Desktop Shortcuts after WPI Install
DEL "%PUBLIC%\DESKTOP\*.lnk"


Strange how the same commands work in a .bat file but not from within WMI :wacko:

James

#10 User is offline   myselfidem 

  • Member
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,392
  • Joined: 06-January 10
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 22 December 2012 - 01:17 AM

Some help about path for batch files using WPI:

http://www.msfn.org/...ost__p__1007716

*Edit: Tested the batch file using with WPI and works fine!
Batch file set inside:.\sources\$OEM$\$$\Setup\scripts\Clean.cmd

This post has been edited by myselfidem: 22 December 2012 - 02:37 AM


#11 User is online   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 8,325
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 December 2012 - 03:49 AM

OR!!

We could use the code WPI has built in?::

{DELETE} "%PUBLIC%\DESKTOP\*.lnk" < --- Yanow in the commandline...

#12 User is offline   AmazingGecko 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 07-November 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 25 December 2012 - 04:45 AM

Hi Kel

As I stated above I did use your suggestion to no avail. I'm starting to wonder if I'm putting in the wrong place. I didn't want to have to add that command to every individual app command page so I put it in the "Execute after" entry on the Options/Tools tab.

Is that the wrong place?

James

#13 User is offline   myselfidem 

  • Member
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,392
  • Joined: 06-January 10
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 25 December 2012 - 09:58 AM

Yes, I use also like this!

useroptions.js
// Tools tab
ExecuteAfter=['"%systemdrive%\\Windows\\SETUP\\SCRIPTS\\clean.vbs"'];


This post has been edited by myselfidem: 25 December 2012 - 02:14 PM


#14 User is offline   myselfidem 

  • Member
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,392
  • Joined: 06-January 10
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 28 December 2012 - 02:38 AM

View PostKelsenellenelvian, on 22 December 2012 - 03:49 AM, said:

OR!!

We could use the code WPI has built in?::

{DELETE} "%PUBLIC%\DESKTOP\*.lnk" < --- Yanow in the commandline...


Thanks Kels! Works fine.

WPI_Log.txt
Spoiler








#15 User is online   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 8,325
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 28 December 2012 - 04:40 AM

OK for SOME unremembered reason we didn't add the special command support in the execute after and before lines.

So for cmd styles you would add the ACTUAL command:

Execute after:

Regedit /s %path%\reg.reg

(As noted in recent post I am not actively developing WPI for a long time so who knows when that will change?)

This post has been edited by Kelsenellenelvian: 28 December 2012 - 04:40 AM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy