Search found 4315 matches

by Squashman
07 Mar 2012 12:47
Forum: DOS Batch Forum
Topic: Admin password "HELP"
Replies: 3
Views: 3494

Re: Admin password "HELP"

%echo% is not your variable. You are using %cho%

I wouldn't use the same variable name for both of your questions. If you just hit enter on the second question which asks for the user name the variable cho is still defined as yes.
by Squashman
07 Mar 2012 12:42
Forum: DOS Batch Forum
Topic: batch write file name in file
Replies: 8
Views: 6873

Re: batch write file name in file

Code: Select all

FOR %%G in (*.txt) do echo %%~nG>>%%G
by Squashman
06 Mar 2012 13:03
Forum: DOS Batch Forum
Topic: Dir /b output into an Array
Replies: 4
Views: 4448

Re: Dir /b output into an Array

foxidrive wrote:In the MSdos days to create a simple menu, the screen was generated like this:

Code: Select all

dir /ad /b |find /n /v ""

Totally forgot about the FIND usage. Thanks foxidrive.
by Squashman
06 Mar 2012 12:07
Forum: DOS Batch Forum
Topic: Batch file searching multiline command output
Replies: 2
Views: 3382

Re: Batch file searching multiline command output

You need to use Delayed Expansion with your variables inside the FOR LOOP. SET /P will only read in the first line when using a file as input. If you need to read the entire file then you need to use a FOR loop to read it. Not understanding why you are outputting the errors to a temp file and then r...
by Squashman
06 Mar 2012 11:52
Forum: DOS Batch Forum
Topic: Dir /b output into an Array
Replies: 4
Views: 4448

Re: Dir /b output into an Array

Code: Select all

@echo off
setlocal enabledelayedexpansion
set /a cnt=0
for /f "tokens=*" %%g in ('dir /b') do (
   set /A cnt+=1
   echo !cnt! '%%g'
)
endlocal
by Squashman
06 Mar 2012 11:19
Forum: DOS Batch Forum
Topic: Dislplay PC - CPU - RAM With DOS via Bat file- Help Needed
Replies: 2
Views: 5455

Re: Dislplay PC - CPU - RAM With DOS via Bat file- Help Need

systeminfo | findstr /C:"Total Physical Memory" /C:"Processor(s)" /C:"Mhz" :Menu set /p answer=Do you wish to continue? : IF /I "%answer%=="N" GOTO :EOF IF /I "%answer%=="Y" GOTO :script GOTO :Menu :script net use Z: /d /y net use Z: \\NAS...
by Squashman
01 Mar 2012 12:53
Forum: DOS Batch Forum
Topic: Find a string and create new files
Replies: 13
Views: 9895

Re: Find a string and create new files

Kind of confused by that.
If you have a file with the field names defined in the first line that are separated by spaces why would you let people put spaces into the data for a particular field. You should have the fields separated by commas.
by Squashman
01 Mar 2012 11:49
Forum: DOS Batch Forum
Topic: Find a string and create new files
Replies: 13
Views: 9895

Re: Find a string and create new files

So there is always six fields separated by Spaces?
Do the Employee names or Company Names ever have spaces in them?
by Squashman
29 Feb 2012 13:34
Forum: DOS Batch Forum
Topic: Search and replace
Replies: 11
Views: 6915

Re: Search and replace

This works as well.

Code: Select all

CMD /C BatchSubstitute.bat Banana Apple Text01.txt>Text02.txt 
print /D:\\Server\Printer_Share Text02.txt
by Squashman
29 Feb 2012 13:13
Forum: DOS Batch Forum
Topic: Search and replace
Replies: 11
Views: 6915

Re: Search and replace

I don't have an explanation for why you need to do this. Someone will be along later I am sure to explain it but for some reason if you CALL the batch file it will work.

Code: Select all

call BatchSubstitute.bat Banana Apple Text01.txt>Text02.txt
print /D:\\Server\Printer_Share Text02.txt
by Squashman
29 Feb 2012 12:57
Forum: DOS Batch Forum
Topic: Search and replace
Replies: 11
Views: 6915

Re: Search and replace

kadara wrote:I tried with the Pause, but nothing changed.

So you are saying that even putting a pause at the end of your script it is just closing not executing the PRINT command.
Did you try typing the PRINT command at the cmd prompt to see if that does indeed work?
by Squashman
29 Feb 2012 12:42
Forum: DOS Batch Forum
Topic: Search and replace
Replies: 11
Views: 6915

Re: Search and replace

Learn something new everyday. Didn't realize you could print directly to the share name. I have always mapped to LPT# and then used the device name. Are you seeing any error messages? Put a PAUSE at the end of your script. If it is printing it will display a message on the screen that it is printing...
by Squashman
29 Feb 2012 10:43
Forum: DOS Batch Forum
Topic: Search and replace
Replies: 11
Views: 6915

Re: Search and replace

The printer needs to be a device. Eg: LPT1
Here is some other options for you.
http://www.robvanderwoude.com/printfiles.php
by Squashman
29 Feb 2012 10:41
Forum: DOS Batch Forum
Topic: Sharepoint automated restore task shedule not working
Replies: 7
Views: 10194

Re: Sharepoint automated restore task shedule not working

When you scheduled the task did you enter in a username and password for the task to run under? Does this use have the appropriate permissions and privileges to run the scheduled task?