![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Windows & DOS: Issues & Discussions Questions involving Unix to Windows (Desktop or Server) go here. Any Windows/DOS questions should go here as well. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| storing result of a command in variable | eltinator | Shell Programming and Scripting | 1 | 04-17-2008 05:09 PM |
| Setting the Results of a Command to a Variable | stky13 | UNIX for Dummies Questions & Answers | 1 | 02-29-2008 12:00 PM |
| assign subst|grep|sed command result to a variable | snowbiker99 | Shell Programming and Scripting | 5 | 11-14-2007 04:08 PM |
| Variable for -name causing issue in Find command | ParNone | UNIX for Dummies Questions & Answers | 2 | 03-24-2006 03:48 PM |
| find command not returning any result | rraajjiibb | UNIX for Advanced & Expert Users | 4 | 07-23-2004 02:05 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Setting a variable to result of FIND command
I am working on a batch script where a filter is placed on a directory, and the files that come out of that filter have to be copied into another directory. More specifically, I am trying to set the results of a FIND command to a variable, so that I may access this variable / file later.
The command I have now is: dir | find "03/07/2005 03:17 PM"|\\ramts11\MarketData\Diag\utils\cut.exe -d " " -f14 The output is in the form of a text file, like: ccm000000493.txt I need to store the name of this file in a variable so I can copy it to a different directory. I tried putting SET /a CCMFile= in front of the command, but that does not assign CCMFile to anything (the variable CCMFile is still set as null). Any help would be greatly appreciated. Thanks a lot, John Favara |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
These commands are ms-dos commands. Our users are not Microsoft experts. I'll move this thread to our DOS forum. But even that is really for unix-mircosoft inter-operability issues. You really should post DOS bat file questions on a Microsoft oriented site.
|
|
#3
|
||||
|
||||
|
I decided to tackle part of this problem. My quest: write a bat file to set the environment variable x to the output of the "cd" command. I am using the newer cmd.exe on Windows XP rather than the older command.exe. Even so, this was harder than it sounds. My final bat file:
Code:
set x=hello
echo before loop %x%
for /f "usebackq" %%x in (`cd`) do (
echo in loop x = %%x
set x=%%x
)
echo after loop %x%
|
||||
| Google The UNIX and Linux Forums |