This is what I'd like to use but not working:
"%~dp0Mick.EXE" /s /v"SERIAL=000000000000" -f1"%~dp0setup.ISS"
Have a program I would like to silently install though would like the ability to install from it's own Dir without the need to specify it path or location for install?
If I install from the root of C installs no problem.
Manufacturer recommends installing as egAny pointers from any scripting dudes is appreciated?C:\"Mick.exe" /s /v"SERIAL=000000000000" -f1"C:\setup.iss"
This is what I'd like to use but not working:
"%~dp0Mick.EXE" /s /v"SERIAL=000000000000" -f1"%~dp0setup.ISS"
When you say not working, why? Are you getting an error message?
Hi Mick,
At a very quick glance, it looks like when you're trying to call the executable, Windows can't find it.
This could be due to a couple of reasons. Is the batch file you're running located in the same directory as Mick.exe?
I haven't done a lot of Windows scripting, but I think %~dp0 refers to the directory and path of the executing script file... so if Mick.exe is not in the same directory, it won't find it.
Some options to consider:
- in the actual script, change directory to the location of Mick.exe before calling it
- again in the script, modify the path environment variable to include the directory where Mick.exe is located
I hope that gives you some ideas...
The %~dp0 is passing the current directory of the bat file you just ran, you are then looking for a prohram called Mick.exe within that same directory. Same for your setup.iss file.
So,
if you executed the bat file from C:\Scripts your command above would read
"C:\Scripts\Mick.EXE" /s /v"SERIAL=000000000000" -f1"C:\Scripts\setup.ISS"
This will fail unless both Mick.exe and Setup.iss are both located in the C:\Scripts\ directory.
Usually most programs always unzip/deploy into the temp directory.
You can use the system variable TEMP or TMP depending on where it was ported from (MS or Unix)
In your script you can use mkdir %TEMP%\mydir to copy all of your files to your newly created mydir.
Reference everything from that point and you don't need to create any directory paths or environment variables and all should be good.
Ok Guys very big thanks to Rate, Simon & JC the explanations that nailed it!
Figured out I was trying to run the script by Elev Cmd prompt when I should have run it from a batch!
All working good now. Just have to taskill the opening page of the prog to make it totally silent.
Thanks again Mick
There are currently 1 users browsing this thread. (0 members and 1 guests)