Is there a way to get the filename of the current query in LINQPad - just as argv[0] in C? Getting only the directory name would also do. 
            Asked
            
        
        
            Active
            
        
            Viewed 3,683 times
        
    20
            
            
         
    
    
        Guðmundur H
        
- 11,478
- 3
- 24
- 22
- 
                    1possible duplicate of [LINQPad script directory?](http://stackoverflow.com/questions/3802779/linqpad-script-directory) – Mark Hurd Mar 07 '14 at 11:10
1 Answers
37
            You can get the directory path like this (from - LINQPad script directory?) -
Path.GetDirectoryName(Util.CurrentQueryPath)
The following (as pointed out by sgmoore in the comments) will get you the file path -
Path.GetFileName(Util.CurrentQueryPath) 
- 
                    Doesn't Path.GetFileName(Util.CurrentQueryPath) give you the filename? – sgmoore Nov 28 '11 at 19:43
- 
                    I don't think so, I've tried it on a couple of different machines and I'm only getting the directory that contains the query. – ipr101 Nov 28 '11 at 20:15
- 
                    
- 
                    @sgmoore - sorry, you were right all along, I couldn't see that for looking!. I've updated the answer, thanks for your help! – ipr101 Nov 28 '11 at 22:21
 
    