Jump to content

run syncronouscommand local


Recommended Posts

Ok so lets say I need to run syncronouscommand to run some files...but lets say I dont know what drive letter they will be, but the file will ALWAYS be on the same drive that vista is installing from.

For example, the dvd drive could be D or it could be E

...this is actually going on from a memory stick and the drive letter changes..either way, my question is,

when runsyncrnouscommand runs, what path is it executing from. Does it run from the root of the drive or from sources?

So another example, if runsyncrouscommand was running from the root, and my app was in a folder called apps on the root then the <path> would simply be /apps/file.exe

So you see what I mean about not specifying drive letter.

<RunSynchronousCommand wcm:action="add">

<Description>Copyapps</Description>

<Path>D:\programs\copyappsvista.cmd</Path>

<Order>1</Order>

<WillReboot>Never</WillReboot>

</RunSynchronousCommand>

So basically I want to be able to run copyappsvista.cmd without specifying drive letter, but whatever drive letter it is, the rest of the path will be the same.

I cant use %cdrom or %dvdrom flags because this is running from a flash drive.

Thanks in advanced.

Link to comment
Share on other sites


I can think of 2 options:

1. Have your install copy the program to install to the hard drive. Then write a wrapper (you can use AutoIT) that installs the program and then deletes the install files when it is done.

2. Put your app on a network share. Map the drive and then your drive letter shouldn't ever change.

Link to comment
Share on other sites

3) use the old for loop around the alphabet trick, or just go read it from the registry.

For The Cdrom you need to set the varible for it

Here are 2 different ways to do it,

FOR /F "TOKENS=3" %%I IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "SourcePath" ^| FINDSTR "SourcePath"') DO SET CDROM=%%~dI
for %%i in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do if exist %%i\SETUP.exe set CDROM=%%i

UPDATED FOR 7:
for %%i in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do if exist %%i\sources\install.wim set MEDIA=%%i
ECHO %MEDIA%

EDIT: and you can use the CDROM variable with a USB disk, in fact you can call the variable anything you like, CDROM, MEDIA, it doesn't make any difference. As long as you use the same name later in the script when you try to access the variable. capisce

Edited by MrJinje
Link to comment
Share on other sites

  • 2 weeks later...

thanks muchly.

i decided to go with cmdlines that copies all my install files to the c drive (for some reason the $ folders arent working) and then running it using C:\ since that never changes (except with stupid card readers sometimes arghhhh).

thanks again

Link to comment
Share on other sites

my mistake. I realized that i posted this question for vista and my solution was for xp (yeah im busy...getting confused between projects). so...i guess it isnt fixed.

So is there no way to just not use a drive letter?

for example, if my working directory was D:\sources and i specified \install\run.exe then the working path would be D:\sources\install\run.exe

See what I mean?

1. Have your install copy the program to install to the hard drive. Then write a wrapper (you can use AutoIT) that installs the program and then deletes the install files when it is done.

Well thats what I want to do, but i need to run a program to do that copying.

Link to comment
Share on other sites

Im going to go ahead and say that on my cmdlines for xp, i am using D:\programs\copyapps.cmd so i guess i've been using a drive letter the whole time and it hasnt broken yet..so i'll just go ahead and do that for vista and pray it doesnt break ;)

Link to comment
Share on other sites

Im going to go ahead and say that on my cmdlines for xp, i am using D:\programs\copyapps.cmd so i guess i've been using a drive letter the whole time and it hasnt broken yet..so i'll just go ahead and do that for vista and pray it doesnt break ;)

Remember that Vista may use different registry paths and DOES use different paths for the User profile and Programs, since there are no Documents and Settings or Program Files folders anymore. So if you are using any absolute paths for XP, you may need to change them. Easiest might be to detect which type of OS it is, and use one method for XP and the other for Vista.

Link to comment
Share on other sites

Ok so apparently in vista, it doesnt like my D:\Install\copyapps.cmd

I'm guessing its a problem with drive letters. works in xp no problem but for whatever reason, it doesnt here. SO I need a solution. What would be helpfull is knowing the working directory and put my copyapps.cmd in that and then use the patch \workingpath\copyapps.cmd instead of D:\install\copyapps.cmd

The problem is that this will be run on multiple computers, so while the main drive install will always be C:, the flash drive could be anything else.

Link to comment
Share on other sites

I found the solution, using $OEM$ folders in vista. I thought I read someonewhere else that this method didnt work in vista but it definately does, theres just a flag you have to enable in autounattend.xml. So now all my folders get copied to the root of the harddrive, which is always C: and then the commands run stuff from C: which works everytime.

Thanks for all the input guys.

*now i wonder why my $oem$ folders didnt work in xp..;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...