I have a user, which couldn’t get along with AutoCAD so he switched back to InterCAD. He’s not too computer literate so now when he tries’s to open a DWG file (AutoCAD native file extension) by double clicking it he’s register settings look for the AutoCAD program to open it.
I know that we can tweak the register settings for a .dwg file to open the file automatically with InterCAD rather then AutoCAD.
I’m not too un-familiar with tweaking the registry keys and when I do I like to automate this using batch script.
What is the best procedure to do this, I'm namely worried I will miss a key or is the following the only key I need to tweak
HKEY_CLASSES_ROOT\.dwg\OpenWithprogids
The extension to execute Intercad in Intercad.exe
How do I successfully achieve my desired result?
The key you need to edit will be this one:
HKEY_CLASSES_ROOT\dwgfile\shell\open\command
That controls the program the file opens with.
To do this in a batch file use this:
reg add HKCR\dwgfile\shell\open\command /v "" /d "programpath.exe" /f
Hope this helps.
Related
I'm a Mac user, but I need to write a script on Windows, and I'm not sure how I should go about that.
Here's the scenario:
Someone adds photos to a USB drive. The drive is then inserted into a digital picture frame.
In order for the photos to autoplay, a 'playlist.asb' file must be present on the drive. I want to create a script that can be clicked on and executed to auto create the playlist file based on the image files added to the USB. The script would do something like this:
Check if there are images in the 'slideshow' folder.
Check if file called 'playlist.alb' exists, if not create it. If so, overwrite it.
Loop through available images.
Add each image name and extension on a new line.
Save (and overwrite any existing playlist file) and exit.
I'm comfortable with AppleScript for Macs, but I'm not sure if a Windows equivalent would make sense, or if some kind of command line script would work better.
Any help is greatly appreciated.
Something like this should do it:
#echo off
setlocal
cd /d %~dp0Slideshow
if exist playlist.alb del playlist.alb
for %%a in (*.jpg *.gif *.png) do (
echo %%~nxa>>playlist.alb
)
I invoke a batch file from my own extension file type.In batch file i will show the details of invoking file. I know by passing parameters when invokation we will pass it and we will get by "%~sn1" OR "%1" OR "%~nx1". But i need without passing parameters.
Sample Example
My batch file code looks like this(main.bat)
#ECHO on
set modelname=(here i want help)
java -Djava.library.path="C:\Program Files\Internet Explorer" -Xms1024m -Xmx1024m -jar dist/XYZ.jar -models %modelname%
exit
If i click "Kitchen.xyz" then it'll invoke my batch file "main.bat". Now i want set "modelname" as "Kitchen.xyz". If i click "LivingRoom.xyz" ,:modelname" set as "LivingRoom.xyz".
Can anyone help please...
Thanks
You will need to change the Windows Registry associated with the file type of .xyz
[HKEY_CLASSES_ROOT\.xyz\shell]
[HKEY_CLASSES_ROOT\.xyz\shell\Name Of Your Command]
#="&Name Of Your Command"
[HKEY_CLASSES_ROOT\.xyz\shell\Name Of Your Command\command]
#="\"C:\\Path\\To\\Your\\Batch\\File\\main.bat\" \"%1\""
Save that text in a .reg file and execute it to apply the registry changes. Then when you right click .xyz files, "Name Of Your Command" will be one of the options and possibly the default option which would run when double clicked.
Then your main.bat still needs to accept one parameter and assign it to modelname.
You could also do that programatically with the REG command, but regardless of which method you use to set things up, something needs to be run to setup each machine you want to do this on.
I am trying to install through batch file..
ECHO OFF
ECHO Installing MySoftware . . .
"%~dp0\MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
pause
but it fails to install.
Not much info to go on. What you have will not work if executed from a UNC drive and may not work if you 'Run as administrator' because the current directory gets changed. Try this. Of course that may not fix it and further details would be nice.
#ECHO OFF
PUSHD "%~dp0"
ECHO Installing MySoftware . . .
"MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
Adding to my answer based on comments provided.
Presumably your bat file is in the same folder as MySoftware.exe. If it takes that long, it sounds like the install is working. Try doing
"MySoftware.exe" /?
That may give you a help screen to tell you more about the arguments beng passed. Also, try what you are now doing without the /S (which probably specifies a "silent" install... which is why you don't see anything.
PART 1 - If you want to create a "Setup" File in batch.
Maybe it works, but this is will be very hard to you for done this program.
Let's call the EXE File "Game1:
I will recommend you to take all the Game1 file's code (Maybe you can use the program Notepad++ for do this) after you taked Game1's code do this like i writing here
Let's say that the code of Game1 is:
ABC
Copy the code, then go to the batch file.
The "Setup" file of Game1 HAVE to come with a empty EXE file.
You can make a empty EXE file with notepad - just save the file as:
Name.exe
Then you doing at the batch file script this thing:
set %something%=ABC
After you done this you adding this to the batch script:
Echo %something% >> Name.exe
Don't forget to name the EXE file at the name of the program / game.
And now, if this message didn't help to you, maybe you need to make a EXE from batch file.
PART 2 - If you want to make an EXE file of batch file.
Open the start menu of Windows and search this:
IExpress
Don't let the computer search for you the full name, its working only if you wtiting the full name.
After you search IExpress, click on "Activate Command".
Click on Next, Don't change the first options.
Click on "Extract files only" and click on Next.
Name the EXE program and click Next.
Stay on "No prompt." and continue.
Now you can display a program License. if you want do a txt file and choose the display option.
Add batch files and click Next.
click on the option you want and click Next.
If you want a finish message, click on display message and write the message.
Here browse where the EXE will be and choose your options, click Next.
click Next.
Wow that's was super-long! Hope I helped you!
Im working on over 700 computers in a school district and have written a small program that i intend to write to a cd. The program is set to autorun when the disk is inserted and prompt the screen resolution of the computer and what computer the building is in (the different school buildings). Afterwards the program will run a batch file that copies a default desktop from the disk and into the windows\web\wallpaper directory. It also replaces other files that have been customized for the school district.
To finish changing the theme of the computer, i need to have the file make a few edits to the group policy and the registry. How would i be able to use the program to makes these changes? Would it all be written into the batch or would the batch have to initiate another file (like a registry file)?
All the group policy editor does is set registry keys. If you can identify what keys are being set for the policy you want, you can use reg.exe to set those keys.
reg.exe add HKCU\Software\path\to\regkey\ /v valuename /d newvalue
Registry will work for the first user, but after a new user logs in, GP will change those settings for the new user.
To make deployment gp, do this: Set one machine's GP to the way you want it. Once you are done, goto C:\windows\System32\GroupPolicy and copy the contents. (note: this is a hidden file). On the next machines you want, just paste back in the file.
If you do this in a batch, you will have to run the batch as administrator to touch the C:\windows\system32 folder. (UAC, the bane IT)
I need help writing a batch file to update templates on a database. Basically, all our clients have their own folder, with multiple templates inside. Due to the computer illiteracy of my office (sigh), there's no real better way to fix this. However, I need a way to update those templates in a batch. For instance
\\SERVER\New Client Template Folder\Correspondence\Transmittal Letter.WPD
is updated. I then need to copy it to:
\\SERVER\Client Files\Client 1\Correspondence;
\\SERVER\Client Files\Client 2\Correspondence;
...etc. Essentially, I need to copy to \\SERVER\Client Files\\*\\, and I need to make it a batch file that I can train someone else to use whenever I leave this job. How can I do that?
Thanks.
The new versions of Windows (7 and 2008 Server R2) have the robust file copy tool (robocopy). This can be installed on XP and 2003 also be installed using the Resource Kit. Essentially, robocopy gives you a command-line directory mirroring tool that could help you accomplish what you're trying to do. Simply place robocopy commands into a batch file (/MIR = mirror directory contents /XJ = ignore junctions) :
robocopy <source_dir> <destination_dir> /MIR /XJ
You didn't indicate which operating system you are working under. Let me guess its windows. My DOS BAT file knowledge is limited, but you
could try creating a BAT file with something like:
set Src="\\SERVER\New Client Template Folder\Correspondence\Transmittal Letter.WPD"
set DestA="\\SERVER\Client Files\
set DestB=\Correspondence;"
FOR /F "delims=" %%i IN (distribution.txt) DO copy %Src% %DestA%%%i%DestB%
and then create a distribution.txt file like:
Client 1
Client 2
Running this BAT file will read the distribution.txt file and issue a copy command for each line in it. As follows:
COPY "\\SERVER\New Client Template Folder\Correspondence\Transmittal Letter.WPD" "\\SERVER\Client Files\Client 1\Correspondence;"
COPY "\\SERVER\New Client Template Folder\Correspondence\Transmittal Letter.WPD" "\\SERVER\Client Files\Client 2\Correspondence;"
But there must be a better way!!!!
You can get more help on the FOR command by typing help for at the DOS prompt.
If you don't like the idea of having to build/maintain the distribution.txt file, you could play with using DIR /A:D /B "\\SERVER\Client Files\*" to drop a directory listing into a temporary file, then use it as input to the FOR loop.