Click here to Skip to main content
15,925,255 members

Comments by Bark Ups (Top 13 by date)

Bark Ups 21-Aug-14 3:49am View    
Sergey is right. It is quiet simple to understand.
fileattribute - mean file can be opened (read) , deleted, append, executed. - gives you permission what you can do with a file.

if file can be accessed and read and user can read content (show on screen) it is also possible to copy it. Even if 'copy' option is not alloved you can still sit down and write it down or make screenshot (wich is also a copy of content). showing content on the screen is equal to copy.

Answering your question: How to make file readonly (c#)

check this out: http://msdn.microsoft.com/en-us/library/system.io.file.setattributes(v=vs.110).aspx


P.S. What exactly you are trying to achive?
Bark Ups 21-Aug-14 3:25am View    
@Joan: As far as i know, there is long history with ping command and strange behavior of it.
You said "ping returning ok" you mean you see ping replay ? if yes it is highly possible that this is not response from your target host but netgate for example. to confirm that you can try to ping any other not existing IP and see if it will give you back same status. (also tracert command is good to check). You can try to use nbtstat command to check if target host is available.

like nbtstat -a aaa.bbb.ccc.ddd - (for %errorlevel%)

or

nbtstat -a aaa.bbb.ccc.ddd | find "MAC" (for MAC adderess and %errorlevel%)




@Sergey: sometimes batch files are your only tool to automate things and yes it makes ppl insane :D but when done correctly with nice logging and backup module implemented to it with cooperation with vbs and wmic its really powerfull tool.
Bark Ups 20-Aug-14 20:59pm View    
Deleted
TotalHours is what you need

check this out http://msdn.microsoft.com/en-us/library/system.timespan.totalhours.aspx
Bark Ups 20-Aug-14 20:48pm View    
Maybe try to pass whole tab content to temporary place and print from there?
like new form with content as preview and print from there or just do it from hidden one?

or make tab area scrennshot than scroll down content and after taking all screenshots combine them to one file?
Bark Ups 20-Aug-14 19:38pm View    
HiI need to disagree with you Sergey at some point.
Batch files are quiet good (for windows) scripting environment if you know what can you do and how!

but to the point:

@Joan: 1st script will always show state marked as 'down' cause on every loop state is setup as down on the beginning. Setup state as down before ":loop" or make "exit" for state 'up' like if state==up goto :label

if it goes about 2nd script should work (tested variation of it on my pc)


---------------START---------------
@echo off
echo %errorlevel% ^<------------
ping -n 1 127.0.0.1
echo %errorlevel% ^<------------
ping -n 1 188.8.8.8
echo %errorlevel% ^<------------

if %errorlevel%==0 goto itsok
if %errorlevel%==1 goto notok

:itsok
echo it is ok
goto end

:notok
echo it is not ok

:end
pause

---------------END---------------


You can try:
-get rid off all rem comments. I had some problems with rem comments on my scripts. From time to time windows is getting crazy when see rem. don't know why.

-you can also try to save %errorlevel% in new variable (set var=%errorlevel% or setlocal var%errorlevel%)

-you can try adding "setlocal EnableDelayedExpansion"
and replace all % signs in variables with ! example %var% --> !var!

regards