Search found 21 matches

by Docfxit
11 Mar 2019 18:52
Forum: DOS Batch Forum
Topic: Get PID from port
Replies: 5
Views: 73

Re: Get PID from port

I don't know what you are expecting. First of all you should enclose the search string into quotes for the findstr command. And instead of "80" you should rather look for ":80\>" where \> marks the right word boundary as explained in the help of findstr. For your command that would mean findstr ":%...
by Docfxit
11 Mar 2019 14:00
Forum: DOS Batch Forum
Topic: Get PID from port
Replies: 5
Views: 73

Re: Get PID from port

That fixed the error really great.

Do you have any idea why the port isn't being substituted in this code?

Code: Select all

set "Port#=80"
for /f "tokens=5" %%a in ('netstat -aon ^| findstr %Port#%') do tasklist /FI "PID eq %%a"
Thank you,
Docfxit
by Docfxit
11 Mar 2019 13:16
Forum: DOS Batch Forum
Topic: Suppress titile on CMD
Replies: 2
Views: 48

Re: Suppress titile on CMD

That's really super. I have been wanting that for years.

Thanks a bunch,

Docfxit
by Docfxit
11 Mar 2019 12:03
Forum: DOS Batch Forum
Topic: Suppress titile on CMD
Replies: 2
Views: 48

Suppress titile on CMD

I'd like to find a way to suppress the title when I use CMD. In a batch file I frequently use CMD at the end to stop the command window from closing. I like to see the command prompt at the end of the window. When I use: @cmd I get: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft C...
by Docfxit
11 Mar 2019 11:54
Forum: DOS Batch Forum
Topic: Get PID from port
Replies: 5
Views: 73

Get PID from port

I have a syntax error when trying to get the PID from a port number:

Code: Select all

for /f "tokens=5" %a in ('netstat -aon ^| findstr 80') do tasklist /FI "PID eq %a"

Code: Select all

a" was unexpected at this time.
Thanks,
Docfxit
by Docfxit
10 Mar 2019 13:52
Forum: DOS Batch Forum
Topic: How to substitute a variable
Replies: 2
Views: 54

Re: How to substitute a variable

Really nice of you to reply so quickly. That did fix the problem and It's really nice of you to explain how it works. I am now getting this output: C:\Dnload\Webserver>Set "MachineName=Docfxit" C:\Dnload\Webserver>Set "UserName=IISUser" C:\Dnload\Webserver>CD \Program Files\fileacl C:\Program Files\...
by Docfxit
10 Mar 2019 13:13
Forum: DOS Batch Forum
Topic: How to substitute a variable
Replies: 2
Views: 54

How to substitute a variable

The set variables are not being substituted where they are supposed to. This is my code: Set MachineName ="Docfxit" Set UserName="IISUser" CD \Program Files\fileacl FILEACL C:\HostingSpaces\Docfxit /D "%MachineName%\IWAM_%MachineName%":WwAWaWePDO /D "%MachineName%\%UserName%":WwAWaWePDO /S "%Machine...
by Docfxit
31 Jan 2019 17:23
Forum: DOS Batch Forum
Topic: Looking for text in a file
Replies: 4
Views: 178

Re: Looking for text in a file

That's supper. That fixed it for me.

It's really great of you to point out what is / should happen.

Thank you very much,

Docfxit
by Docfxit
31 Jan 2019 16:04
Forum: DOS Batch Forum
Topic: Looking for text in a file
Replies: 4
Views: 178

Re: Looking for text in a file

Thank you for taking a look at it.

The only thing I have is a pause after the line. (I have added the pause in my example)

The script goes to the pause instead of going to Done.

Thanks,

Docfxit
by Docfxit
31 Jan 2019 11:38
Forum: DOS Batch Forum
Topic: Looking for text in a file
Replies: 4
Views: 178

Looking for text in a file

I am writing out a file and trying to find some text in the file. It isn't finding the text. Bootrec /scanos >"%~dp0BootFixerTest.txt" type "%~dp0BootFixerTest.txt" |find /i "Windows installations: 0" >nul || goto :Done Pause :Done The file has in it: Scanning all disks for Windows installations. Pl...
by Docfxit
31 Jan 2019 11:27
Forum: DOS Batch Forum
Topic: Syntax error
Replies: 4
Views: 160

Re: Syntax error

That is excellent. It's working perfectly now. You are all really great for helping me fix this.

Thanks a bunch,

Docfxit
by Docfxit
31 Jan 2019 00:03
Forum: DOS Batch Forum
Topic: Syntax error
Replies: 4
Views: 160

Syntax error

I'm getting this error: ( was unexpected at this time. set "_WinVer=Windows 10" Just before this code: If "%_WinVer%==Windows 10" ( bcdedit.exe /create /d "Windows 10" /application osloader >"%~dp0BootFixerGUID.txt" ) pause Else ::Now we have a clean, working Win 7 bootloader. But we need to add a W...
by Docfxit
10 Jan 2019 12:04
Forum: DOS Batch Forum
Topic: The system was unable to find the specified registry key or value
Replies: 4
Views: 175

Re: The system was unable to find the specified registry key or value

This finds the registry key but requires me to answer the delete: set "RegKey=HKEY_LOCAL_MACHINE\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v "PastIconsStream"=-" reg delete "%regkey%" /f And I get this: set "RegKey=HKEY_LOCAL_MACHINE\Software\Classes\Loca...
by Docfxit
10 Jan 2019 12:00
Forum: DOS Batch Forum
Topic: The system was unable to find the specified registry key or value
Replies: 4
Views: 175

Re: The system was unable to find the specified registry key or value

This is what the key looks like coming from the registry: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify] "PromotedIconCache"="{7820NR76-23R3-4229-82P1-R41PO67Q5O9P},{7820NR75-23R3-4229-82P1-R41PO67Q5O9P},{...
by Docfxit
10 Jan 2019 04:57
Forum: DOS Batch Forum
Topic: The system was unable to find the specified registry key or value
Replies: 4
Views: 175

The system was unable to find the specified registry key or value

In a batch file I have: set "RegKey="HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify"" reg delete %regkey% /v PastIconsStream=- /f This is what I get when I run it: C:\Windows\System32>reg delete "HKCU\Software\Classes\Local Settings\Software\Mi crosoft\Wind...