Windows Bat-file for Drag n Drop Imagefile for Imagemagick - drag-and-drop

it s the first time i try this page. I ve just installed imagemagick on a windows 7 machine and the command "identify" is excactly what i ve been looking for.
I just want to do a bat file now, where i can drag a imagefile on it and then this command will be executed and a txt-file with the result will be saved.
I just cant handle it. What i ve got until now is:
set SOURCE=%1
identify -verbose %SOURCE%
But my Output is just a:
set SOURCE=-verbose
identify -verbose -verbose
So he is changing my Source-Variable? Why?
This seems to be so short and simple but i really got stucked now.
Maybe someone could give me a hint. Thx in advance

Just do this.
#echo off
set /p SOURCE=%1
echo.
echo Command: identify -verbose %SOURCE%
identify -verbose %SOURCE%
pause

Related

Command line will not run MAXScript

I have a command line code as follows -
for /r %%v in (*.max) do start %%v
It opens any Max file in the same folder - great.
I want it to also tell max to run any number of scripts when the file has opened, there are guides on how to do this on the 3dsMax help for eg:
-U MAXScript = (this will open MAXScript and run a certain script on the end of a fresh 3dsmax command load.
However this does not work on the end of the initial code I need to use.
I have been researching how this could work for 2 days but keep going in circles.
Please help.
Adam
try for /r %%v in (*.max) do START cmd.exe /C %%v
You might want to take a look at using 3dsmaxbatch.exe instead of 3dsmax.exe
Here is a link to the 2019 documentation:
https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/3DSMax-Batch/files/GUID-48A78515-C24B-4E46-AC5F-884FBCF40D59-htm.html
The command line to load a max file then execute a script should look like this
3dsmaxbatch.exe -sceneFile C:/some/path/to/maxfile.max C:/some/path/to/script.ms

xcopy one file to many computers in txt file

I am trying to copy one script file (DBFF.cmd) to many computers. I have created a computerlist.txt to list the names of each computer. On each line I have just the list of names ex. (win-ali) will someone please tell me where I may be going wrong?
for /F %%a in (computerlist.txt) do xcopy "\\tc\Install\Firefox_Deploy\DBFF.cmd" "\\%%a\c$\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp"
Without knowing what issues/errors you're encountering, it's going to be difficult to troubleshoot.
That being said, your example should work within a batch file. It will not work straight from the command line.
If you need it to work from the command line, change %%a to %a:
for /F %a in (computerlist.txt) do xcopy "\\tc\Install\Firefox_Deploy\DBFF.cmd" "\\%a\c$\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp"
Here's an old Microsoft post about the percent signs being stripped from batch files: https://support.microsoft.com/en-us/kb/75634

How can i use Relative or Environment variable in Batch command

I am running below command to run Soapui Test suite and it is working fine
testrunner.bat -s"TestSuite4" "D:\Invesco\JP Groovy Code\ExploreGroovy.xml"
I ahve also used with below command and it is working fine as well
testrunner.bat -s"TestSuite4" "%USERPROFILE%\ExploreGroovy.xml"
Now I have added one Envrionment variable 'EnvP' and its value id 'D:\Invesco' and tried with following command but it is not working.
testrunner.bat -s"TestSuite4" "%EnvP%\ExploreGroovy.xml"
Can some one help me in this. I don't want to give hard coded path of any drive. Please suggest if anyone has any other solution.
Thanks.
the process starting testrunner.bat (probably explorer.exe?) must
know about the new variable. have you tried logging out and in again
after setting it?
if it is cmd, try finding the variable with set | find "EnvP". If it is not there, you need to start a new cmd session.
Use these commands and you should see why it fails:
#echo "%EnvP%"
#if not exist "%EnvP%\ExploreGroovy.xml" #echo Ouch!
#pause
testrunner.bat -s"TestSuite4" "%EnvP%\ExploreGroovy.xml"
#pause
For all my SoapUI projects I have multiple .bat scripts in the same location as the project.xml file to run different sets of test suites, and all of it goes into your source repository.
IF NOT DEFINED SOAPUI_ROOT SET SOAPUI_ROOT=%ProgramFiles%\SmartBear\soapUI-Pro-4.6.4
REM make certain we are where we _think_ we are
CD %~dp0
REM cleanup previous results
DEL /f /q *.log*
RMDIR /s /q results
REM run the tests
CALL "%SOAPUI_ROOT%\bin\testrunner.bat" -s"Smoke TestSuite" -fresults My-soapui-project.xml
REM determine if there are failures
IF errorlevel 0 (
ECHO All tests passed.
PAUSE
EXIT 0
) ELSE (
ECHO There are failures!
PAUSE
EXIT 100
)

How can I make a command line command work for any user?

Is there any way that I can use CMD magic to where any one can type it in and it work for them? For example: This command works for me
RD /S "C:\Users\Kyle\FolderToDelete"
How can I make a command that will work for anyone? This is what I would like it to do.
RD /S "C:\Users\%UniversalUser%\FolderToDelete"
Before you think I am trying to do something malicious to someone's computer, I'm not.
In a game I play, there was a recent messup with the game, and players need to delete a certain directory and redownload it in order for it to work.
You are looking for %user% or %userprofile% The following two lines are equivalent:
RD /S "C:\Users\%User%\FolderToDelete"
RD /S "%UserProfile%\FolderToDelete"
EDIT: As Sujay Sarma correctly stated: %user will not work if the user name is munged or the user has been migrated. For example if you upgraded or inplace reinstalled, your username may still be "kyle" but your folder will be "kyle_000" or something.
The root directory of the user's folder is stored in the Windows environment variable %UserProfile%. All you need is this one variable to trigger the delete.
RD /S "%UserProfile%\FolderToDelete"
(Eg: For a username of "Kyle", %UserProfile% will evaluate to "C:\Users\Kyle").
will do the trick.

cmd System cannot find file

I have a very weird resule in cmd, the current folder is test :
c:\test>
with
c:\test\>dir
10/04/2013 18:06 <REP> 10042013
in the folder test I've put a exe : oggenc.exe
c:\test\>copy oggenc.exe 10042013
Although when I do a copy the system tells me it cannot find the specified file
I really can't understand what's going wrong, can you please help me ? Thanks in advance
xcopy /h oggenc.exe 10042013
Does the trick, my file was hidden that's why copy couldn't do the job, problem solved, thank you.
That's because c:\test\copy isn't an executable. copy is.
Check to see if you have the appropriate permissions. In my test case I was able to create a folder "C:\test" but not copy my own %userprofile% into "C:\test"
when I opened the cmd as administrator it worked just fine!
I tried to post a picture but apparently don't have a high enough rep yet. sorry.
here is a link to the picture instead
http://bit.ly/1ubwjY4