This is what I want to do.
Windows 7 installs from CD, DVD or USB drive.
Windows installation completes.
windows explorer opens to a specific folder based upon media used to install windows.
The below code is what I have so far.
timeout 10
msg * You need to install programs from this directory as appropriate to your needs
explorer %basefolder%\App Installs
Is there a Special folder that refers to the basefolder? I know of %appdata% and %USERPROFILE% but do not know if there is one that can refer to the media used whether USB drive or DVD.
I know I can copy the App Installers to the computer and then run a batch file but the directory is quite large (>2GB) and would really slow down the installation.
If running the script from the installation media, you can reference the media drive path by using %~d0. Else, if running from a network drive or locally, you can scan each drive for a unique file or folder.
for %%A in (a b 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 "%%~A:\unique_file.txt" echo Found my drive.
This will launch the installer from the folder/usb/dvd and then explorer will open in the "\App Installs" folder on the same media.
The working directory will only change if you specifically leave the device that the installer was launched from.
installer.exe "to target folder"
explorer "\App Installs"
Related
I am running a Lua program on a Windows 10 machine. This Windows 10 computer is networked to another Windows 10 computer and this other computer is sharing its D: drive with my computer. The shared drive is called the O: drive by my computer.
When I open a cmd window on my computer and type:
type "O:\Data\config\file.xml"
I get the contents of file.xml in my cmd window. However, if I run this same command through Lua:
f = io.popen([["type O:\Data\config\file.xml"]])
output = f:read("*l")
Then output returns as nil.
This behavior is true of any command involving the shared O: drive, not just type. Similarly, I have some bat scripts that reference the O: drive, and I call these using os.execute, but they are not able to accomplish their task (I can see they are actually executing, just not correctly). However, if I run similar commands or scripts with the local D: or C: drives, I do not have this issue.
Any ideas as to what could be different between these two calls? Is there a different way I can call the O: drive?
My Lua application was running as a service, and I determined that when it was running as a service it was running as a 'guest' user, rather than my system user. Therefore, it did not have the appropriate permissions to run.
I modified my Windows service to run as my specific user, and this resolved the issue.
Lets say I have PC A(with folder C:\PCA) and PC B (with folder C:\PCB)
first i do a WNetAddConnection2 to map PCB folder on PC A with S drive letter
followed by a copy command cmd.exe /C copy S:*.* C:\PCA\ /Y
but this will be just copy all files in PCB to PCA everytime i call it
I'm looking for a way to Sync PCA and PCB (One way is ok) and the process should copy only files with changes(to save bandwidth).
This type of action could be performed on Linux with a tool called rsync
Maybe try take a look at this answer:
https://superuser.com/questions/69514/windows-alternative-to-rsync
for some Windows alternatives.
I've compiled openssl on drive J: using this tutorial and, running our program that loads libeay32.dll, I got an error on a Windows Server 2012 64bits:
"... Insert disk in drive J:..."
Using a HEX editor, I've seen that libeay32.dll contains a fixed path:
"J:\openssl\src\openssl-1.0.2d-x64\out32dll\libeay32.pdb"
I've found 2 solutions:
replacing J: with an X:
compiling openssl on a drive C:
The first solution is unacceptable.
The second one is acceptable but done without knowing the reason.
I can imagine that Windows complains about a missing disk in drive J: because J: is in the drive list
`wmic logicaldisk get caption`
and, thus, not if drive X: has been specified as it's not in the list.
But why does it not complain if C: has been specified and there's no file:
"C:\openssl\src\openssl-1.0.2d-x64\out32dll\libeay32.pdb" on the PC?
How can I know which file is it trying to access?
I've tried to use depends22, Process Explorer, Process Monitor but I could not see any file access on J:.
edit:
another solution is to replace the complete path with spaces
A client has a nas box (nas01) and a batch script to connect three drives to it at startup.
net use h: \\nas01\home\Foo /user:Foo bar
net use m: \\nas01\music /user:Foo bar
net use p: \\nas01\media /user:Foo bar
From windows Explorer clicking on M and H drive gets him into the folders. P drive fails with a cross through it.
I opened a command prompt (cmd) as administrator (right click run as administrator) and ran the batch.
It succeeded under CMD.
It failed to let the user in under Windows Explorer.
I used net use * /delete from the CMD prompt then ran the following line manually.
net use p: \\nas01\media /user:Foo bar
In cmd I can do a dir p: and see the files, I can change to p: drive, change folders and see sub folders and files. From Windows Explorer it get Nada.
A manual disconnect for each drive then re map of drives under windows explorer fixed the issue - all four drives accessible, but it leaves me with a batch file my client cant use when Windows drops the mapped drives again in the future.
Why is one side of windows (CMD) working but not useable under Windows Explorer? Any thoughts.
User has full admin rights on PC, local login, no UAC getting in the way.
As a favour, I'm compiling a number of videos on a DVD. They're all different resolutions, codecs and containers. To save myself sometime I thought I'd just bundle in MPC and have a batch script launch them. I was told they need an icon and since there's no way to make dynamic shortcuts in Windows using %CD%, as far as I could find.
Very simple batch script:
START "" "%cd%\MPC-HC\mpc-hc.exe" "%cd%\VideoFiles\01.mp4"
So I've tried a few BAT to EXE apps and found that they really just decompress the BAT and run it. They use %CD% as their temp folder which makes it impossible to launch from a disc.
So I found ExeScript and I can alter the temp directory... Only problem? The BAT then launches from there then, meaning%CD% is useless.
So once again I alter the batch file to sniff out the disc drive:
for %%a 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 %%a:\01.exe
set rundir=%%a:
START "" "%rundir%\MPC-HC\mpc-hc.exe" "%rundir%\VideoFiles\01.mp4"
This works well enough (causes an error if disc trays are open or empty), however if the files are copied to the HDD, then it doesn't as it'll try to read from the CD. There's no way of knowing if it's being launched from a hard drive or disc.
At this point I'd even appreciate help on how to write something like this in C and avoid batch files all together (and thus the temp file mess).
I've solved this by putting on a version for from the drive and one for from the HDD. Easiest solution.
What about relative folder paths?
START "" "MPC-HC\mpc-hc.exe" "VideoFiles\01.mp4"
That should work on HDD and CD alike.