Jump to content











Photo
- - - - -

Files are not on system drive but are on CD/USB


  • Please log in to reply
4 replies to this topic

#1 burnin240sx

burnin240sx
  • Members
  • 5 posts
  •  
    United States

Posted 10 November 2008 - 10:12 PM

Hello,
I have added a few scripts to my Vist PE that run bat and EXE files with makescript and they are included on the cd when i build it. now the issue that I have is that with BartPE I would use a variable in my script like
%systemdrive% to refrence the location of certain files with bartPE as the drive may change depending on how many hard drives are in the computer.

With VistaPE they are located on the CD/USB drive (Which can change letters) and not the system drive, and I can't figure out how to get them on the system drive. I'm afraid that if i hard code the path in my script then I may have issues.

for instance if a computer has more then one hard drive then the cd will not be drive D it will be another drive and the hard coded script call will fail.

Anyone have any suggestions? I'm using makescript to make embed my custom scripts.

#2 JonF

JonF

    Gold Member

  • .script developer
  • 1185 posts
  • Location:Boston, MA
  •  
    United States

Posted 10 November 2008 - 11:29 PM

Programs stored on the system drive are "run from RAM". Typically you put pCheckBox1 on your interface labeled "Run from RAM". Then you start your script with

RunFromRam,%pCheckBox1%

There's also a "Force all to RAM" checkbox somewhere at the beginnnig, in basic configuration. Or you could just do:

RunFromRam,True

Once you've called RunFromRAM, you can use %PE_Programs% in your calls to Add_Shortcut and the resutling shortcut will be evaluated at boot time to point to the corrrect drive and directory. Like my shortcut to run AdAware from a cmd file but display the AdAware icon on the shortcut:

[variables]%ProgramEXE%=AdAware.cmd%ProgramFolder%=AdAware SE%ProgramTitle%=AdAware SE[Process]Echo,Processing %ProgramTitle%...RunFromRam,%pRadioButton1%      .     .     .Add_Shortcut,Desktop,,,,,"%pRadioButton2% %pScrollBox1% %pCheckBox4% %pCheckBox1%","%PE_Programs%\%ProgramFolder%\Ad-Aware.exe",1
You can also use %PE_Programs% if you have registry entries with paths. For maximum compatibility with other projects, it's best to create the registry entry at build time and at boot time, since other projects don't really have RegAddBoot:
Hive_Load,HKCUReg_Add,0x1,"%reg%\Software\Safer Networking Limited\SpybotSnD","Version","1.6.0"Reg_Add,0x2,"%reg%\Software\Safer Networking Limited\SpybotSnD","Path","%PE_Programs%\%ProgramFolder%\"Hive_Unload,HKCU// For VistaPERegAddBoot,"HKCU",0x1,"Software\Safer Networking Limited\SpybotSnD","Path","%PE_Programs%\%ProgramFolder%\"

You cannot use %PE_Programs% in any other context, such as manipulating files and folders.

See http://www.vistape.n...istape-api.html. It's not complete and it's not particularly well written, but there is a lot of good information there.

#3 Arvy

Arvy

    Frequent Member

  • Developer
  • 430 posts
  • Location:Canada, Parry Sound
  • Interests:IT, Outdoors, Horses
  •  
    Canada

Posted 11 November 2008 - 07:17 AM

... with BartPE I would use a variable in my script like %systemdrive% to refrence the location of certain files ...


You can also do that with VistaPE. In fact, that's exactly how VistaPE's own "Run All from RAM" option works:
If,"%ForceAllToRam%",Equal,"Yes",Set,"%PE_Programs%","#$pSystemDrive#$p\Program#$sFiles"

Note the use of the #$p substitution items for the %SystemDrive% entries. In addition, any such registry entries must be of the REG_EXPAND_SZ type (RegWrite,HKLM,0x2,...) for proper handling by Windoze.

The problem with that is, as you say, that the %SystemDrive% and the %CDDrive% aren't necesarily the same. So some application settings, shortcuts, etc. can only be determined at boot time and assigned via the vistape.cfg route.

#4 paraglider

paraglider

    Gold Member

  • .script developer
  • 1743 posts
  • Location:NC,USA
  •  
    United States

Posted 11 November 2008 - 12:33 PM

As long as your boot image that is loaded into ram is formatted as NTFS or allows junction points to be created then you can create a junction from x:\program files to a directory on another drive. That way it can always be referenced via the boot drive.

That's what you do when you mount a wim so it may be possible to mount a second wim into a directory in the boot wim image.

#5 burnin240sx

burnin240sx
  • Members
  • 5 posts
  •  
    United States

Posted 11 November 2008 - 02:51 PM

Thank you very much. I figured it was something easy I was missing.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users